Merge branch 'dantetwc-master'. Closes #16340
[arvados.git] / lib / dispatchcloud / container / queue_test.go
index bb8226118cb4dc91a36d5c5382fa5b3e8e5a1487..0075ee324ef8eb1d10a54207af97ddbf6a70b6bf 100644 (file)
@@ -106,6 +106,13 @@ func (suite *IntegrationSuite) TestGetLockUnlockCancel(c *check.C) {
 
 func (suite *IntegrationSuite) TestCancelIfNoInstanceType(c *check.C) {
        errorTypeChooser := func(ctr *arvados.Container) (arvados.InstanceType, error) {
+               // Make sure the relevant container fields are
+               // actually populated.
+               c.Check(ctr.ContainerImage, check.Equals, "test")
+               c.Check(ctr.RuntimeConstraints.VCPUs, check.Equals, 4)
+               c.Check(ctr.RuntimeConstraints.RAM, check.Equals, int64(12000000000))
+               c.Check(ctr.Mounts["/tmp"].Capacity, check.Equals, int64(24000000000))
+               c.Check(ctr.Mounts["/var/spool/cwl"].Capacity, check.Equals, int64(24000000000))
                return arvados.InstanceType{}, errors.New("no suitable instance type")
        }
 
@@ -134,10 +141,11 @@ func (suite *IntegrationSuite) TestCancelIfNoInstanceType(c *check.C) {
        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
        })