Skip to content

Tests: a Windows file lock during managed-PostgreSQL test cleanup no longer fails the test - #4581

Merged
erikdarlingdata merged 1 commit into
devfrom
fix/managed-pg-test-cleanup-lock
Sep 28, 2026
Merged

erikdarlingdata merged 1 commit into
devfrom
fix/managed-pg-test-cleanup-lock

Conversation

@erikdarlingdata

@erikdarlingdata erikdarlingdata commented Sep 28, 2026 •

Copy link
Copy Markdown
Owner

Why

DarlingManagedPostgresTests.Postgres17Store_WithTheOldValueInItsManagedConf_StartsWithTheCap_Gated failed twice on Windows CI after every assertion had passed. Its finally deletes the test's temp directory, and a file the just-stopped PostgreSQL process still maps (icudt67.dll) makes the delete throw UnauthorizedAccessException:

System.UnauthorizedAccessException : Access to the path 'icudt67.dll' is denied.
   at System.IO.DirectoryInfo.Delete(Boolean recursive)

The cleanup was already meant to be best-effort ("a temp directory the OS still holds is not this test's failure"), but it caught only IOException, and UnauthorizedAccessException is not one.

What changes

Test code only. Every best-effort temp-directory delete that runs after a PostgreSQL stop, and that already caught IOException, now catches IOException or UnauthorizedAccessException (8 sites):

  • DarlingManagedPostgresTests.cs: the flaky test's cleanup and two siblings with the same shape.
  • DarlingCollectorToggleVerbLivePostgresTests.cs, ManagedConfMigrationRunnerTests.cs, ManagedConfMigrationStateTests.cs, ManagedConfMigrationStepsTests.cs and ManagedConfUpgradePathTests.cs: the same cleanup pattern.

No assertion changes.

Test plan

  • Darling.Tests builds with 0 warnings.
  • The gated tests need Windows and the bundled PostgreSQL runtimes. On this PR they SKIP: the previous-major runtime fixture (DARLING_TEST_PGRUNTIME_OLD) is built only for changes in the Darling store paths, and this change is test-only. The widened catch is exercised by the next PR or nightly run that builds the fixture.

CHANGELOG

None: test-only change.

@erikdarlingdata
erikdarlingdata marked this pull request as ready for review September 28, 2026 14:13
@erikdarlingdata
erikdarlingdata merged commit 133de04 into dev Sep 28, 2026
19 of 20 checks passed
@erikdarlingdata
erikdarlingdata deleted the fix/managed-pg-test-cleanup-lock branch September 28, 2026 14:13
erikdarlingdata added a commit that referenced this pull request Sep 30, 2026
… longer fails the store-move test (#4864)

A managed PostgreSQL store test failed once in CI with an access-denied IOException from Directory.Move. The move runs right after the test stops the managed PostgreSQL. On Windows, a file the stopped process still maps can hold its folder for a moment, and until then the rename is refused.

- The tests get a retrying move, MoveDirectoryOnceReleased. It tries the move again every 100 ms for up to 10 seconds while Windows refuses it. After that, the last exception escapes.
- The store-move test uses it for its one move after the stop. Its assertions are unchanged.
- Three Windows-only tests hold a file open without sharing in place of the process. A plain move is refused, and the retrying move completes once the file is released. A lock that never lifts fails only after the patience runs out.
- The other moves in the Darling tests do not follow the stop of a real PostgreSQL, and they are unchanged.
- Test-only change.

Follow-up to #4581.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant