Repository navigation
Test: the managed stale-block --check-settings test migrates its own darling store, so it passes on a bare rig - #4691
Merged
Conversation
…ing store it creates CheckSettingsAsync_ManagedStoreWithAStaleBlock_ReturnsStaleSettingsExitCode_Gated created an empty "darling" database when none existed, then read collect.managed_conf_verdicts from it and died with 42P01 on any rig whose DARLING_TEST_PG database is not itself named darling. CI hid it: darling-pg's DARLING_TEST_PG names Database=darling, which the live-postgres collection fixture migrates before the first test. The test now runs PgMigrations.MigrateAsync on darling itself (idempotent, Pooling=false so the finally's DROP is not pinned), so it no longer depends on another test or on order. Every assertion is unchanged. Surfaced on PR #4681. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NKkGR7ZBZavtGbVYcK58GC
erikdarlingdata
marked this pull request as ready for review
September 29, 2026 00:28
erikdarlingdata
deleted the
fix/darling-tests-bare-rig-and-readcount
branch
September 29, 2026 00:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No issue filed; both defects surfaced in the full-suite run for PR #4681 and were ruled test defects. This PR fixes item 1 only. Item 2 is parked below with the diagnosis so far (see "Item 2: not done").
Why
DarlingCliCommandsHostCheckTests.CheckSettingsAsync_ManagedStoreWithAStaleBlock_ReturnsStaleSettingsExitCode_Gatedfailed on a bare rig with42P01: relation "collect.managed_conf_verdicts" does not exist.The managed connect path always targets a database named
darling. The test created an emptydarlingdatabase when none existed, then--check-settingsreadcollect.managed_conf_verdictsfrom it. CI never showed this becausedarling-pgsetsDARLING_TEST_PGwithDatabase=darling(build.yml, "Run Darling PG tests"), and thelive-postgrescollection fixture migrates that very database before the first test runs. On any rig whose suite database has another name (mine:darlingtest), nothing migrateddarling, so the test passed only after some other test had.What changes
One test file,
Darling/Darling.Tests/DarlingCliCommandsHostCheckTests.cs: the test now runsPgMigrations.MigrateAsyncondarlingitself, as the first statement inside the existingtry, so thefinallystill drops a database the test created even if the migration throws.MigrateAsyncis idempotent (the fixture makes the same call), so it is a no-op where the store is already established. The connection usesPooling=falseso it cannot pin the database against theDROP. No product code changed. Every assertion and the existingDARLING_TEST_PGskip are unchanged. No new skip was added.Test plan
Rig: PostgreSQL 18.6 from the repo's
pg-runtime.zip, port 5573,timezone/log_timezoneUTC,shared_preload_libraries = 'timescaledb,pg_stat_statements'(whatdarling-pgsets at build.yml line 1003; with onlytimescaledbpreloaded, item 2's test would skip), workers 74 / 85 as CI. Suite databasedarlingtest; nodarlingdatabase existed before any run below.-method "*CheckSettingsAsync_ManagedStoreWithAStaleBlock*"failed withNpgsql.PostgresException : 42P01: relation "collect.managed_conf_verdicts" does not exist.darlingabsent before and after):-class "*DarlingCliCommandsHostCheckTests*"Total 7, Failed 0, Skipped 0. The test ran on its own in the first pass, so it depends on no other test's setup or on order.CheckSettingsAsyncreturningOkfor the stale arm). The test failed withExpected: 3, Actual: 0. Reverted; rebuilt.LivePostgresCollectionHygieneTests,LiveCleanupConversionRatchetTests): 103 tests, 0 failed.CI: which job runs each test
Both tests run in the
darling-pgjob (build.yml,windows-latest, 3 shards by class-name hash) and neither is skipped there:DARLING_TEST_PGis empty.darling-pgsets it (Port=5541;Database=darling).WaitRateTileReadCountLiveTests): skipped only whenpg_stat_statementsis missing fromshared_preload_librariesor TimescaleDB is missing.darling-pgpreloadstimescaledb,pg_stat_statements.Item 2: not in this PR (diagnosis so far)
WaitRateTileReadCountLiveTests.Waits_DetectAnomaliesAsync_ReadsWaitRateTileWindowSqlOnce_NotTwice. Baseline on this UTC rig: passes alone (Total 2 with item 1's test, 1 failed = item 1's). I did not reproduce the full-suite failure. PR #4681's report says only "passes when its class is re-run alone on a freshly created database (load-sensitive under the full run)"; it records nocallsvalue. Getting that value (0 or 2) comes first, because it separates the two stories:oid.pg_stat_statements_reset()isStoreStatementStatsLiveTests.cs:166, and it runs on that test's own managed cluster on a free port, not the shared rig.OverviewFleetHealthSingleFlightLiveTests,QueryStoreTrendRoutingCachedLiveTests,StoreSizeCacheLiveTests) are scoped to their own databaseoid.PgAnomalyDetector.DetectWaitAnomaliesreadsWaitRateTileWindowSqlonce (PgAnomalyDetector.cs:671) on its own connection; no retry logic and no static cache there (PgBaselineProvider's cache is per instance).darling-pg, which sets neither)pg_stat_statements.maxis 5000 andtrack_utilityis on. Every parallel own-store class replays the migration ladder in its own scratch database, which creates thousands of distinct entries and repeated dealloc passes. Acalls = 1row evicted between the detector run and the count sums to 0. A value of 2 would contradict this story and would need a reconcile before going further.-class *WaitRateTileReadCountLiveTests*together with migration-heavy own-store classes (candidates above) while watchingpg_stat_statements_info.deallocon a probe connection.pg_stat_statements. Count on the test's ownNpgsqlDataSource, built withNpgsqlDataSourceBuilderand a test-localILoggerFactory(or anActivityListeneron Npgsql'sActivitySourcefiltered bydb.name= the scratch database, since a listener is process-wide), counting executed command texts that contain bothpeak_ms_per_secandv_wait_stats. KeepAssert.Equal(1, calls)literally. RED: plant a secondExecuteReaderofWaitRateTileWindowSqlinDetectWaitAnomaliesand show the test fails. The preload-skip guard becomes dead and would be removed and named as a guard removal; the class doc comment would be rewritten to match. Still to verify: that Npgsql's command log carries the SQL text without parameter logging.CHANGELOG
None: test-only change.
Notes
darling-pgpreloadspg_stat_statementstoo.