fix: rename_retry helper for Windows flaky relocation tests#105
Merged
Conversation
On Windows, git subprocesses spawned by init_git_remote keep file handles open briefly after the process exits, causing std::fs::rename and std::fs::remove_dir_all to fail with "Access is denied" under parallel test load. Fixes: - Add rename_retry() test helper that retries with exponential back-off (up to 10 attempts, 20-200ms delays) - Replace all 7 std::fs::rename(...).unwrap() calls in the repos test module with rename_retry() - Change remove_dir_all(...).unwrap() in try_relocate_none_when_ambiguous to let _ = ... (the assertion holds either way) Verified stable: 3 consecutive full-suite runs with 432 passed, 0 failed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Summary
std::fs::renamefails intermittently under parallel test load on Windows because git subprocesses frominit_git_remotebriefly keep file handles open after exit.rename_retry()test helper that retries up to 10 times with exponential back-off (20–200 ms delays).std::fs::rename(...).unwrap()calls in the repos test module withrename_retry().remove_dir_all(...).unwrap()tolet _ = ...(assertion holds either way).Test plan
cargo fmt --check— PASSEDcargo check --all-targets— PASSEDcargo clippy --all-targets -- -D warnings— PASSEDcargo test --lib× 3 — 432 passed, 0 failed each run🤖 Generated with Claude Code