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 }) }