test: stabilize TestRebase_interactiveRetryPreservesTerminal on Windows#1227
Merged
Conversation
Collaborator
Author
|
This change is part of the following stack: Change managed by git-spice. |
fcdbdc8 to
a96fc2a
Compare
removing the lock. On Windows runners the scheduler occasionally didn't release the goroutine in time, so the retry path observed the lock still present and the test failed. Remove the goroutine entirely. The first mock call (which simulates git's lock-conflict failure) now removes the lock atomically before returning the error, so by the time the retry path runs there is no timing dependency. No sleep, no goroutine, no race.
a96fc2a to
b4ac703
Compare
abhinav
approved these changes
Jun 7, 2026
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
TestRebase_interactiveRetryPreservesTerminalflakes on Windows because the test relies on a goroutine sleeping 20ms before removing a fake.git/index.lock. On Windows runners the scheduler doesn't always release the goroutine before the retry path runs — when it doesn't, the test sees the lock still present and fails.Before
After
No sleep, no goroutine, no race.
Why this matters
The flake masked CI on multiple unrelated PRs in the current stack (e.g. #1221), wasting workflow runs and obscuring real failures. Fix is independent of any feature work.
Test plan
go test -run TestRebase_interactiveRetryPreservesTerminal -count=10 ./internal/git/— 10/10 passing locally