From 08bf53a3396ab74e805d468ccbb9c0cea86a3d5a Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Fri, 28 Oct 2022 11:08:39 -0400 Subject: [PATCH] 18071: Improve test timeout. Test can take longer when output is going to a terminal. Keep trying if some progress is made every 3s, rather than giving up after 10s total. Arvados-DCO-1.1-Signed-off-by: Tom Clegg --- lib/dispatchcloud/dispatcher_test.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/dispatchcloud/dispatcher_test.go b/lib/dispatchcloud/dispatcher_test.go index bdbdf1ef9d..2d486da5fd 100644 --- a/lib/dispatchcloud/dispatcher_test.go +++ b/lib/dispatchcloud/dispatcher_test.go @@ -193,12 +193,18 @@ func (s *DispatcherSuite) TestDispatchToStubDriver(c *check.C) { err := s.disp.CheckHealth() c.Check(err, check.IsNil) - select { - case <-done: - c.Logf("containers finished (%s), waiting for instances to shutdown and queue to clear", time.Since(start)) - case <-time.After(10 * time.Second): - c.Fatalf("timed out; still waiting for %d containers: %q", len(waiting), waiting) + for len(waiting) > 0 { + waswaiting := len(waiting) + select { + case <-done: + // loop will end because len(waiting)==0 + case <-time.After(3 * time.Second): + if len(waiting) >= waswaiting { + c.Fatalf("timed out; no progress in 3s while waiting for %d containers: %q", len(waiting), waiting) + } + } } + c.Logf("containers finished (%s), waiting for instances to shutdown and queue to clear", time.Since(start)) deadline := time.Now().Add(5 * time.Second) for range time.NewTicker(10 * time.Millisecond).C { -- 2.30.2