diff --git a/controller/internal/web/async_restore_test.go b/controller/internal/web/async_restore_test.go index f59e7e3..7583e87 100644 --- a/controller/internal/web/async_restore_test.go +++ b/controller/internal/web/async_restore_test.go @@ -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) }