diff --git a/service/submitqueue/demo/run_test.go b/service/submitqueue/demo/run_test.go index 20c3bbbba..0e86b284c 100644 --- a/service/submitqueue/demo/run_test.go +++ b/service/submitqueue/demo/run_test.go @@ -333,6 +333,7 @@ func TestSiblingFailureDoesNotCancelInFlightLand(t *testing.T) { opts := fixtureOptions() opts.Count, opts.Concurrency = 3, 3 landStarted := make(chan struct{}) + thirdWaiting := make(chan struct{}) siblingsCancelled := make(chan struct{}) var landErr error gateway := NewMockGateway(gomock.NewController(t)) @@ -347,9 +348,12 @@ func TestSiblingFailureDoesNotCancelInFlightLand(t *testing.T) { readiness.EXPECT().Wait(gomock.Any(), gomock.Any()).DoAndReturn(func(gate context.Context, change Change) error { switch { case strings.HasSuffix(change.Branch, "/1"): + // Change 3 must be inside Wait before the gate cancels, or it is skipped and nothing releases Land. <-landStarted + <-thirdWaiting return fmt.Errorf("not ready") case strings.HasSuffix(change.Branch, "/3"): + close(thirdWaiting) <-gate.Done() close(siblingsCancelled) return gate.Err()