From: Tom Clegg Date: Mon, 13 Mar 2023 14:56:39 +0000 (-0400) Subject: 19972: Fix racy test case. X-Git-Tag: 2.6.0~15^2 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/9bf4ff58bd13f456e3ee3aa229ca4ab1e98bcae4 19972: Fix racy test case. Arvados-DCO-1.1-Signed-off-by: Tom Clegg --- diff --git a/services/keep-balance/balance_run_test.go b/services/keep-balance/balance_run_test.go index fb1c74d2fe..aeed517d09 100644 --- a/services/keep-balance/balance_run_test.go +++ b/services/keep-balance/balance_run_test.go @@ -663,7 +663,10 @@ func (s *runSuite) TestRunForever(c *check.C) { // first run should also send 4 empty trash lists at // startup. We should complete all four runs in much less than // a second. - for t0 := time.Now(); pullReqs.Count() < 16 && time.Since(t0) < 10*time.Second; { + for t0 := time.Now(); time.Since(t0) < 10*time.Second; { + if pullReqs.Count() >= 16 && trashReqs.Count() == pullReqs.Count()+4 { + break + } time.Sleep(time.Millisecond) } cancel()