X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/5b7be380a48b83c2c87427892db209483ab193af..6c56f80642aae0ec0ff0bfc939ae33dd49e0ca6b:/services/keepstore/handler_test.go diff --git a/services/keepstore/handler_test.go b/services/keepstore/handler_test.go index 7429d7ad41..f012ea3902 100644 --- a/services/keepstore/handler_test.go +++ b/services/keepstore/handler_test.go @@ -975,7 +975,7 @@ func TestGetHandlerClientDisconnect(t *testing.T) { ok := make(chan struct{}) go func() { req, _ := http.NewRequest("GET", fmt.Sprintf("/%s+%d", TestHash, len(TestBlock)), nil) - (&LoggingRESTRouter{router: MakeRESTRouter()}).ServeHTTP(resp, req) + MakeRESTRouter().ServeHTTP(resp, req) ok <- struct{}{} }() @@ -1107,7 +1107,7 @@ func TestUntrashHandler(t *testing.T) { response = IssueRequest(datamanagerWrongMethodReq) ExpectStatusCode(t, "Only PUT method is supported for untrash", - http.StatusBadRequest, + http.StatusMethodNotAllowed, response) // datamanagerReq => StatusOK @@ -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()) } }