X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/fd50115d7e01a595f65e47dd95b129362d18e975..e4a35f3914481226a2a4ff57618bc486839aa2ea:/services/keepstore/handler_test.go diff --git a/services/keepstore/handler_test.go b/services/keepstore/handler_test.go index 7429d7ad41..424910dfa8 100644 --- a/services/keepstore/handler_test.go +++ b/services/keepstore/handler_test.go @@ -1155,59 +1155,19 @@ func TestUntrashHandlerWithNoWritableVolumes(t *testing.T) { } func TestHealthCheckPing(t *testing.T) { - defer teardown() - - KeepVM = MakeTestVolumeManager(2) - defer KeepVM.Close() - - // ping when disabled - theConfig.ManagementToken = "" - pingReq := &RequestTester{ - method: "GET", - uri: "/_health/ping", - } - response := IssueHealthCheckRequest(pingReq) - ExpectStatusCode(t, - "disabled", - http.StatusNotFound, - response) - - // ping with no token theConfig.ManagementToken = arvadostest.ManagementToken - pingReq = &RequestTester{ - method: "GET", - uri: "/_health/ping", - } - response = IssueHealthCheckRequest(pingReq) - ExpectStatusCode(t, - "authorization required", - http.StatusUnauthorized, - response) - - // ping with wrong token - pingReq = &RequestTester{ - method: "GET", - uri: "/_health/ping", - apiToken: "youarenotwelcomehere", - } - response = IssueHealthCheckRequest(pingReq) - ExpectStatusCode(t, - "authorization error", - http.StatusForbidden, - response) - - // ping with management token - pingReq = &RequestTester{ + pingReq := &RequestTester{ method: "GET", uri: "/_health/ping", apiToken: arvadostest.ManagementToken, } - response = IssueHealthCheckRequest(pingReq) + response := IssueHealthCheckRequest(pingReq) ExpectStatusCode(t, "", http.StatusOK, response) - if !strings.Contains(response.Body.String(), `{"health":"OK"}`) { - t.Errorf("expected response to include %s: got %s", `{"health":"OK"}`, response.Body.String()) + want := `{"health":"OK"}` + if !strings.Contains(response.Body.String(), want) { + t.Errorf("expected response to include %s: got %s", want, response.Body.String()) } }