test: fix TestBackupTier2Restore_DoubleClickRefused scheduling flake
IsRunning flips before the restore goroutine parks in StopStack; under parallel load the ==1 assertion raced it and read 0. Wait for the first stop to land, then assert — the red-proof property (no-fast-path mutant → count 2) is preserved. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PSK5g6qYLknKj8u3QAFEr6
This commit is contained in:
@@ -148,6 +148,9 @@ func TestBackupTier2Restore_DoubleClickRefused(t *testing.T) {
|
||||
if loc := w2.Header().Get("Location"); !strings.Contains(loc, "m%C3%A1r+fut") && !strings.Contains(loc, "már fut") {
|
||||
t.Fatalf("second POST should be refused with 'már fut'; got %q", loc)
|
||||
}
|
||||
// IsRunning flips before the goroutine reaches StopStack — wait for the FIRST stop to land, so
|
||||
// the ==1 assertion below measures "no second launch", not goroutine scheduling (parallel-load flake).
|
||||
waitFor(t, func() bool { return atomic.LoadInt32(&prov.stops) >= 1 }, "first restore reached StopStack")
|
||||
if got := atomic.LoadInt32(&prov.stops); got != 1 {
|
||||
t.Fatalf("double-click launched a second restore: StopStack count = %d, want 1", got)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user