Repository navigation
app tests: a read-loops factory that writes after its backend closed is named - #2174
Merged
Merged
Conversation
…is named TestStartOnItsOwnLaunchesWhatTheStartRulesAllow failed once under load with 'TempDir RemoveAll cleanup: unlinkat .../v3/factory: directory not empty'. backend.Close already runs before that removal and stops the poll, intake, triage, runner and server, and no late write could be reproduced (idle and at reduced CPU), so the writer is unknown. Every backend in the read-loops tests now closes through closeQuietly, registered after the home exists so it runs before its removal: it closes the backend, watches the factory folder for 4 x 50 ms, and fails naming each file written after the close with its relative path, size and mtime, plus the test name. The next red says what wrote. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
What changes
TestStartOnItsOwnLaunchesWhatTheStartRulesAllowfailed once on a busy machine during cleanup: "TempDir RemoveAll cleanup: unlinkat …/v3/factory: directory not empty". Something wrote into the factory folder while the test's temporary home was being removed.The backend already closes before that removal. Its close stops the poll, intake, triage, runner and server, and waits for them. I could not reproduce a late write, either at normal speed or at reduced CPU, so the writer is still unknown.
This PR makes the next occurrence say what wrote. Every backend in the read-loops tests now closes through one helper,
closeQuietly. It is registered after the home exists, so it runs before the home is removed. The helper:The helper covers every backend in the file, including the restarted one (
reopened) and both engines in the joined-factory test.Evidence
TestALateFactoryWriteIsNamedWithItsSizeAndTimeis the helper's own test. It writes a file into the watched folder after the watch starts.The total added time for
cmd/codeafis about 0.8 s. A quiet factory costs the full 200 ms watch; a test with no started factory costs nothing.Limits
🤖 Generated with Claude Code