From dd0d156b9edc7130e859d3b23d8a886950ed94e7 Mon Sep 17 00:00:00 2001 From: jochen Date: Sat, 24 Oct 2026 04:25:12 +0200 Subject: [PATCH] Wait for the third run to start, not only for its take, so the capacity test does not race under a loaded suite --- go/buildstep/pull_test.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/go/buildstep/pull_test.go b/go/buildstep/pull_test.go index 6d0b326..ddfd33a 100644 --- a/go/buildstep/pull_test.go +++ b/go/buildstep/pull_test.go @@ -127,11 +127,8 @@ func TestPullHoldsAtMostItsCapacity(t *testing.T) { } release <- struct{}{} waitFor(t, "the third taken", func() bool { return src.Waiting(delivery.AskDelivery) == 0 }) - mu.Lock() - if started != 3 { - t.Errorf("started %d, want 3", started) - } - mu.Unlock() + // Taken from the source comes a moment before its run starts: wait for the start, not only the take. + waitFor(t, "the third started", func() bool { mu.Lock(); defer mu.Unlock(); return started == 3 }) close(release) waitFor(t, "all acked", func() bool { a, _, _ := src.Fates(); return len(a) == 3 }) }