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
8579e30d
Commit
8579e30d
authored
Mar 01, 2017
by
Pawel Chojnacki
Committed by
Jérome Perrin
Nov 19, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix tests to work with go 1.8
parent
c3682335
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletion
+6
-1
internal/testhelper/testhelper.go
internal/testhelper/testhelper.go
+5
-0
proxy_test.go
proxy_test.go
+1
-1
No files found.
internal/testhelper/testhelper.go
View file @
8579e30d
...
...
@@ -20,6 +20,11 @@ func AssertResponseBody(t *testing.T, response *httptest.ResponseRecorder, expec
}
}
func
AssertResponseBodyRegexp
(
t
*
testing
.
T
,
response
*
httptest
.
ResponseRecorder
,
expectedBody
*
regexp
.
Regexp
)
{
if
!
expectedBody
.
MatchString
(
response
.
Body
.
String
())
{
t
.
Fatalf
(
"for HTTP request expected to receive body matching %q, got %q instead"
,
expectedBody
.
String
(),
response
.
Body
.
String
())
}
}
func
AssertResponseHeader
(
t
*
testing
.
T
,
response
*
httptest
.
ResponseRecorder
,
header
string
,
expectedValue
string
)
{
if
response
.
Header
()
.
Get
(
header
)
!=
expectedValue
{
t
.
Fatalf
(
"for HTTP request expected to receive the header %q with %q, got %q"
,
header
,
expectedValue
,
response
.
Header
()
.
Get
(
header
))
...
...
proxy_test.go
View file @
8579e30d
...
...
@@ -67,7 +67,7 @@ func TestProxyError(t *testing.T) {
w
:=
httptest
.
NewRecorder
()
newProxy
(
"http://localhost:655575/"
,
nil
)
.
ServeHTTP
(
w
,
httpRequest
)
testhelper
.
AssertResponseCode
(
t
,
w
,
502
)
testhelper
.
AssertResponseBody
(
t
,
w
,
"dial tcp: invalid port 655575"
)
testhelper
.
AssertResponseBody
Regexp
(
t
,
w
,
regexp
.
MustCompile
(
"dial tcp:.*invalid port.*"
)
)
}
func
TestProxyReadTimeout
(
t
*
testing
.
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