test(host): temp directories clean up after themselves (STORY-441, closes #710) - #786
Merged
Merged
Conversation
…tch dirs (gh-#710) Adds TempDir (IDisposable scratch directory under gw-*, recursive delete on Dispose) and TempSweep.Run, which removes stale gw-/genwave-pawire-/ story343-env-/gh332- directories older than 1h. A module initializer runs the sweep once per Host.Tests process against the real temp root. The dev box had accumulated ~60k gw-* directories because specs creating scratch dirs directly via CreateTempSubdirectory had no cleanup path when a run was killed mid-test.
33 files: using var for method-scoped scratch dirs, fixture-owned TempDir fields disposed alongside the scenario that created them, and TempDir.CreateForProcessLifetime() for static helpers that hand a bare path to child processes across many call sites. Story441's own pin file no longer contains the literal API name it scans for. Every scratch directory now has an explicit owner instead of leaking to the OS temp root on a killed run — a Story346 test run leaves /tmp's gw-* count flat instead of growing.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Closes #710. PR-2 of the gh-#777 epic (STORY-441).
🧹 What
TempDiris the one way a Host.Tests spec owns a scratch directory:gw-prefix under the temp root, recursive delete on dispose, tolerant of a directory that already vanished.TempSweep.Runremoves stalegw-*,genwave-pawire-*,story343-env-*andgh332-*directories older than one hour; a module initializer runs it once per test process against the real temp root.CreateTempSubdirectorycall site (33 files) moved ontoTempDir:using varfor method scope, a fixture-owned field for scenario scope,TempDir.CreateForProcessLifetime()for static helpers that hand paths to child processes.Support/TempDir.csis the only remaining call site.📏 Counts (T481 wire, dev box)
ls /tmp | grep -c '^gw-'before Story346 runFeatureAdoptionVerifyRepair)gw-count aftergw-445 → 0✅ Gate
dotnet test GenWave.sln --filter "Category!=Integration" -- xUnit.MaxParallelThreads=3: all nine projects green (Host 2902 passed / 210 skipped / 0 failed).