X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/15c688d1c4b41232536d0a275dd5c0fdb8879a00..49717fb59156c2b276ccc2fde0b9f2de71e812a6:/lib/dispatchcloud/dispatcher_test.go?ds=sidebyside diff --git a/lib/dispatchcloud/dispatcher_test.go b/lib/dispatchcloud/dispatcher_test.go index 6b8620ade3..6b73e71ccd 100644 --- a/lib/dispatchcloud/dispatcher_test.go +++ b/lib/dispatchcloud/dispatcher_test.go @@ -49,6 +49,7 @@ func (s *DispatcherSuite) SetUpTest(c *check.C) { } s.cluster = &arvados.Cluster{ + ManagementToken: "test-management-token", Containers: arvados.ContainersConfig{ DispatchPrivateKey: string(dispatchprivraw), StaleLockTimeout: arvados.Duration(5 * time.Millisecond), @@ -65,6 +66,8 @@ func (s *DispatcherSuite) SetUpTest(c *check.C) { MaxProbesPerSecond: 1000, TimeoutSignal: arvados.Duration(3 * time.Millisecond), TimeoutTERM: arvados.Duration(20 * time.Millisecond), + ResourceTags: map[string]string{"testtag": "test value"}, + TagKeyPrefix: "test:", }, }, InstanceTypes: arvados.InstanceTypeMap{ @@ -191,6 +194,18 @@ func (s *DispatcherSuite) TestDispatchToStubDriver(c *check.C) { c.Fatalf("timed out with %d containers (%v), %d instances (%+v)", len(ents), ents, len(insts), insts) } } + + req := httptest.NewRequest("GET", "/metrics", nil) + req.Header.Set("Authorization", "Bearer "+s.cluster.ManagementToken) + resp := httptest.NewRecorder() + s.disp.ServeHTTP(resp, req) + 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="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].*`) + c.Check(resp.Body.String(), check.Matches, `(?ms).*instances_disappeared{state="unknown"} 0\n.*`) } func (s *DispatcherSuite) TestAPIPermissions(c *check.C) {