19972: Fix racy test case.
authorTom Clegg <tom@curii.com>
Mon, 13 Mar 2023 14:56:39 +0000 (10:56 -0400)
committerTom Clegg <tom@curii.com>
Mon, 13 Mar 2023 14:56:39 +0000 (10:56 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

services/keep-balance/balance_run_test.go

index fb1c74d2fe4adfb178fcd1a44a2ceba3a0e1e4e9..aeed517d094e93bf2b67a4a65a6cae0396847874 100644 (file)
@@ -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()