Commit c83914c5 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Return error 500, if possible, from GET /info/refs

parent 48e5ef89
...@@ -36,7 +36,7 @@ func handleGetInfoRefs(rw http.ResponseWriter, r *http.Request, a *api.Response) ...@@ -36,7 +36,7 @@ func handleGetInfoRefs(rw http.ResponseWriter, r *http.Request, a *api.Response)
} }
if err != nil { if err != nil {
helper.LogError(r, fmt.Errorf("handleGetInfoRefs: %v", err)) helper.Fail500(w, r, fmt.Errorf("handleGetInfoRefs: %v", err))
} }
} }
......
...@@ -131,6 +131,34 @@ func TestDeniedClone(t *testing.T) { ...@@ -131,6 +131,34 @@ func TestDeniedClone(t *testing.T) {
} }
} }
func TestFailedCloneNoGitaly(t *testing.T) {
// Prepare clone directory
if err := os.RemoveAll(scratchDir); err != nil {
t.Fatal(err)
}
authBody := &api.Response{
GL_ID: "user-123",
RepoPath: repoPath(t),
// This will create a failure to connect to Gitaly
GitalySocketPath: "/nonexistent",
}
// Prepare test server and backend
ts := testAuthServer(nil, 200, authBody)
defer ts.Close()
ws := startWorkhorseServer(ts.URL)
defer ws.Close()
// Do the git clone
cloneCmd := exec.Command("git", "clone", fmt.Sprintf("%s/%s", ws.URL, testRepo), checkoutDir)
out, err := cloneCmd.CombinedOutput()
t.Logf("%s", out)
if err == nil {
t.Fatal("git clone should have failed")
}
}
func TestAllowedPush(t *testing.T) { func TestAllowedPush(t *testing.T) {
preparePushRepo(t) preparePushRepo(t)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment