When each call to Update from the test case was starting its own
lock-update-cancel goroutine, some of these would still be
running (and attempting to cancel the container) after the test case
had succeeded and called /database/reset -- and thus cause a different
test case to fail.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@tomclegg.ca>
go func() {
if ctr.State == arvados.ContainerStateQueued {
// Can't set runtime error without
- // locking first. If Lock() is
- // successful, it will call addEnt()
- // again itself, and we'll fall
- // through to the
- // setRuntimeError/Cancel code below.
+ // locking first.
err := cq.Lock(ctr.UUID)
if err != nil {
logger.WithError(err).Warn("lock failed")
+ return
// ...and try again on the
// next Update, if the problem
// still exists.
}
- return
}
var err error
defer func() {
c.Check(err, check.IsNil)
c.Check(ctr.State, check.Equals, arvados.ContainerStateQueued)
+ go cq.Update()
+
// Wait for the cancel operation to take effect. Container
// will have state=Cancelled or just disappear from the queue.
suite.waitfor(c, time.Second, func() bool {
- cq.Update()
err := client.RequestAndDecode(&ctr, "GET", "arvados/v1/containers/"+arvadostest.QueuedContainerUUID, nil, nil)
return err == nil && ctr.State == arvados.ContainerStateCancelled
})