From 9b53bca72f8ead7960865be21b93f5849659e21b Mon Sep 17 00:00:00 2001 From: Erik Darling <2136037+erikdarlingdata@users.noreply.github.com> Date: Mon, 28 Sep 2026 20:14:22 -0400 Subject: [PATCH] Test: the managed stale-block --check-settings test migrates the darling 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 Claude-Session: https://claude.ai/code/session_01NKkGR7ZBZavtGbVYcK58GC --- .../DarlingCliCommandsHostCheckTests.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Darling/Darling.Tests/DarlingCliCommandsHostCheckTests.cs b/Darling/Darling.Tests/DarlingCliCommandsHostCheckTests.cs index f477bca739..39ded3a261 100644 --- a/Darling/Darling.Tests/DarlingCliCommandsHostCheckTests.cs +++ b/Darling/Darling.Tests/DarlingCliCommandsHostCheckTests.cs @@ -174,6 +174,23 @@ the rig's own. */ var root = Directory.CreateTempSubdirectory("darling-checksettings-stale-"); try { + /* Migrate "darling" itself, whether this test just created it or found it there. Creating the + database is not enough: the managed path ends in DarlingStoreHostProfile.ReadStoredManagedConf + VerdictsAsync, which reads collect.managed_conf_verdicts (V146), and an empty database throws + 42P01 before any verdict is judged. CI never showed it only because darling-pg's DARLING_TEST_PG + names Database=darling: the live-postgres collection fixture migrates that very database before + the first test runs. On a rig whose suite database has any other name (darlingtest, say) nothing + ever migrated "darling", so the test passed only after some other test had. MigrateAsync is + idempotent (the fixture makes the same call), so this is a no-op where the store is already + established and the whole setup where it is not — no dependency on another test or on order. + Pooling=false: this connection must not pin the database against the DROP in the finally. */ + var darlingBuilder = new NpgsqlConnectionStringBuilder(connectionString) { Database = "darling", Pooling = false }; + await using (var darling = new NpgsqlConnection(darlingBuilder.ConnectionString)) + { + await darling.OpenAsync(ct); + await PgMigrations.MigrateAsync(darling, ct); + } + var dataDirectory = Path.Combine(root.FullName, "data"); Directory.CreateDirectory(dataDirectory);