From e2599b42db123fdf17cf141f39396fc12004222d Mon Sep 17 00:00:00 2001 From: Pavlo Strokov Date: Thu, 26 Nov 2020 16:59:32 +0200 Subject: gitaly-hooks check: check is not a gitaly hook 'check' subcommand is not a real hook and should not write to the same log used by actual gitaly-hook subcommands. The 'GitlabNetClient.Check' method of the gitlab-shell lib expects to get a JSON with 'message' field in case of an error. The mock server aligned with that expectation. As a result the error message has another content. Part of: https://gitlab.com/gitlab-org/gitaly/-/issues/2699 --- internal/testhelper/testserver.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'internal/testhelper/testserver.go') diff --git a/internal/testhelper/testserver.go b/internal/testhelper/testserver.go index d8a2f6d47..486708749 100644 --- a/internal/testhelper/testserver.go +++ b/internal/testhelper/testserver.go @@ -789,7 +789,10 @@ func handleCheck(options GitlabTestServerOptions) func(w http.ResponseWriter, r return func(w http.ResponseWriter, r *http.Request) { u, p, ok := r.BasicAuth() if !ok || u != options.User || p != options.Password { - http.Error(w, "authorization failed", http.StatusUnauthorized) + w.WriteHeader(http.StatusUnauthorized) + json.NewEncoder(w).Encode(struct { + Message string `json:"message"` + }{Message: "authorization failed"}) return } -- cgit v1.2.3