19166: Account for auto-retry in integration test.
authorTom Clegg <tom@curii.com>
Wed, 22 Jun 2022 13:56:18 +0000 (09:56 -0400)
committerTom Clegg <tom@curii.com>
Fri, 24 Jun 2022 18:23:25 +0000 (14:23 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

lib/controller/integration_test.go

index 67d60197e7e160b5f7d99e510106a55a18ffd07f..65d34315a5c53fded0ff9cb335d82272376b3980 100644 (file)
@@ -1189,15 +1189,21 @@ func (s *IntegrationSuite) runContainer(c *check.C, clusterID string, ctrSpec ma
        deadline := time.Now().Add(time.Minute)
 wait:
        for ; ; lastState = ctr.State {
+               if time.Now().After(deadline) {
+                       c.Errorf("timed out, container request state is %q", cr.State)
+                       showlogs(ctr.Log)
+                       c.FailNow()
+               }
                err = ac.RequestAndDecode(&ctr, "GET", "/arvados/v1/containers/"+cr.ContainerUUID, nil, nil)
-               c.Assert(err, check.IsNil)
+               if err != nil {
+                       // container req is being auto-retried with a new container uuid
+                       ac.RequestAndDecode(&cr, "GET", "/arvados/v1/container_requests/"+cr.UUID, nil, nil)
+                       c.Assert(err, check.IsNil)
+                       time.Sleep(time.Second / 2)
+                       continue
+               }
                switch ctr.State {
                case lastState:
-                       if time.Now().After(deadline) {
-                               c.Errorf("timed out, container request state is %q", cr.State)
-                               showlogs(ctr.Log)
-                               c.FailNow()
-                       }
                        time.Sleep(time.Second / 2)
                case arvados.ContainerStateComplete:
                        break wait