15340: Fix uncounted Destroy ops.
authorTom Clegg <tclegg@veritasgenetics.com>
Fri, 21 Jun 2019 20:12:56 +0000 (16:12 -0400)
committerTom Clegg <tclegg@veritasgenetics.com>
Fri, 21 Jun 2019 20:13:21 +0000 (16:13 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg@veritasgenetics.com>

lib/dispatchcloud/dispatcher_test.go
lib/dispatchcloud/driver.go

index 6b73e71ccd4267c5e9e6f13749499d8feb3f1a6f..07fdc672282d5475308a9f010555f9a0efc241c6 100644 (file)
@@ -202,6 +202,7 @@ func (s *DispatcherSuite) TestDispatchToStubDriver(c *check.C) {
        c.Check(resp.Code, check.Equals, http.StatusOK)
        c.Check(resp.Body.String(), check.Matches, `(?ms).*driver_operations{error="0",operation="Create"} [^0].*`)
        c.Check(resp.Body.String(), check.Matches, `(?ms).*driver_operations{error="0",operation="List"} [^0].*`)
+       c.Check(resp.Body.String(), check.Matches, `(?ms).*driver_operations{error="0",operation="Destroy"} [^0].*`)
        c.Check(resp.Body.String(), check.Matches, `(?ms).*driver_operations{error="1",operation="Create"} [^0].*`)
        c.Check(resp.Body.String(), check.Matches, `(?ms).*driver_operations{error="1",operation="List"} 0\n.*`)
        c.Check(resp.Body.String(), check.Matches, `(?ms).*instances_disappeared{state="shutdown"} [^0].*`)
index a8f3d5b5edce06411d7001809caf05ab51e49846..6162c81b63bc4589df0d4beb3bbe6bc35a4330e8 100644 (file)
@@ -150,7 +150,11 @@ func (is instrumentedInstanceSet) Create(it arvados.InstanceType, image cloud.Im
 func (is instrumentedInstanceSet) Instances(tags cloud.InstanceTags) ([]cloud.Instance, error) {
        instances, err := is.InstanceSet.Instances(tags)
        is.cv.WithLabelValues("List", boolLabelValue(err != nil)).Inc()
-       return instances, err
+       var instrumented []cloud.Instance
+       for _, i := range instances {
+               instrumented = append(instrumented, instrumentedInstance{i, is.cv})
+       }
+       return instrumented, err
 }
 
 type instrumentedInstance struct {