Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-workhorse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-workhorse
Commits
c83914c5
Commit
c83914c5
authored
Mar 23, 2017
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return error 500, if possible, from GET /info/refs
parent
48e5ef89
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletion
+29
-1
internal/git/info-refs.go
internal/git/info-refs.go
+1
-1
main_test.go
main_test.go
+28
-0
No files found.
internal/git/info-refs.go
View file @
c83914c5
...
@@ -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
))
}
}
}
}
...
...
main_test.go
View file @
c83914c5
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment