Commit ccbc989d authored by Nick Thomas's avatar Nick Thomas

Merge branch 'add_go_1_8' into 'master'

Update Go used for testing to 1.6.4 1.7.5 and add 1.8.0

See merge request !135
parents c481d4a9 b2ce3364
gitlab-workhorse
testdata/data testdata/data
testdata/scratch testdata/scratch
testdata/public testdata/public
gitlab-zip-cat /gitlab-workhorse
gitlab-zip-metadata /gitlab-zip-cat
_build /gitlab-zip-metadata
/_build
.test_template: &test_definition .test_template: &test_definition
script: script:
- apt-get update -qq && apt-get install -y unzip bzip2 - apt update -qq && apt install -y unzip bzip2
- go version - go version
- make test - make test
test:go1.5.4: test using go 1.5:
<<: *test_definition <<: *test_definition
image: golang:1.5.4 image: golang:1.5
test:go1.6.3: test using go 1.6:
<<: *test_definition <<: *test_definition
image: golang:1.6.3 image: golang:1.6
test:go1.7.1: test using go 1.7:
<<: *test_definition <<: *test_definition
image: golang:1.7.1 image: golang:1.7
test using go 1.8:
<<: *test_definition
image: golang:1.8
test:release: test:release:
only: only:
......
...@@ -65,6 +65,12 @@ func AssertResponseBody(t *testing.T, response *httptest.ResponseRecorder, expec ...@@ -65,6 +65,12 @@ 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, w http.ResponseWriter, header string, expected ...string) { func AssertResponseHeader(t *testing.T, w http.ResponseWriter, header string, expected ...string) {
actual := w.Header()[http.CanonicalHeaderKey(header)] actual := w.Header()[http.CanonicalHeaderKey(header)]
......
...@@ -83,7 +83,7 @@ func TestProxyError(t *testing.T) { ...@@ -83,7 +83,7 @@ func TestProxyError(t *testing.T) {
w := httptest.NewRecorder() w := httptest.NewRecorder()
newProxy("http://localhost:655575/", nil).ServeHTTP(w, httpRequest) newProxy("http://localhost:655575/", nil).ServeHTTP(w, httpRequest)
testhelper.AssertResponseCode(t, w, 502) testhelper.AssertResponseCode(t, w, 502)
testhelper.AssertResponseBody(t, w, "dial tcp: invalid port 655575") testhelper.AssertResponseBodyRegexp(t, w, regexp.MustCompile("dial tcp:.*invalid port.*"))
} }
func TestProxyReadTimeout(t *testing.T) { func TestProxyReadTimeout(t *testing.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