Commit e845314b authored by Jacob Vosmaer's avatar Jacob Vosmaer

Move test helpers into seperate package

parent 2893a29b
...@@ -3,6 +3,7 @@ package main ...@@ -3,6 +3,7 @@ package main
import ( import (
"./internal/api" "./internal/api"
"./internal/helper" "./internal/helper"
"./internal/testhelper"
"fmt" "fmt"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
...@@ -29,7 +30,7 @@ func runPreAuthorizeHandler(t *testing.T, suffix string, url *regexp.Regexp, api ...@@ -29,7 +30,7 @@ func runPreAuthorizeHandler(t *testing.T, suffix string, url *regexp.Regexp, api
response := httptest.NewRecorder() response := httptest.NewRecorder()
a.PreAuthorizeHandler(okHandler, suffix).ServeHTTP(response, httpRequest) a.PreAuthorizeHandler(okHandler, suffix).ServeHTTP(response, httpRequest)
helper.AssertResponseCode(t, response, expectedCode) testhelper.AssertResponseCode(t, response, expectedCode)
return response return response
} }
......
package helper
import (
"log"
"net/http"
"net/http/httptest"
"regexp"
"testing"
)
func AssertResponseCode(t *testing.T, response *httptest.ResponseRecorder, expectedCode int) {
if response.Code != expectedCode {
t.Fatalf("for HTTP request expected to get %d, got %d instead", expectedCode, response.Code)
}
}
func AssertResponseBody(t *testing.T, response *httptest.ResponseRecorder, expectedBody string) {
if response.Body.String() != expectedBody {
t.Fatalf("for HTTP request expected to receive %q, got %q instead as body", expectedBody, 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))
}
}
func TestServerWithHandler(url *regexp.Regexp, handler http.HandlerFunc) *httptest.Server {
return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if url != nil && !url.MatchString(r.URL.Path) {
log.Println("UPSTREAM", r.Method, r.URL, "DENY")
w.WriteHeader(404)
return
}
if version := r.Header.Get("Gitlab-Workhorse"); version == "" {
log.Println("UPSTREAM", r.Method, r.URL, "DENY")
w.WriteHeader(403)
return
}
handler(w, r)
}))
}
package staticpages package staticpages
import ( import (
"../helper" "../testhelper"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
...@@ -51,6 +51,6 @@ func TestIfDeployPageExist(t *testing.T) { ...@@ -51,6 +51,6 @@ func TestIfDeployPageExist(t *testing.T) {
} }
w.Flush() w.Flush()
helper.AssertResponseCode(t, w, 200) testhelper.AssertResponseCode(t, w, 200)
helper.AssertResponseBody(t, w, deployPage) testhelper.AssertResponseBody(t, w, deployPage)
} }
package staticpages package staticpages
import ( import (
"../helper" "../testhelper"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
...@@ -30,8 +30,8 @@ func TestIfErrorPageIsPresented(t *testing.T) { ...@@ -30,8 +30,8 @@ func TestIfErrorPageIsPresented(t *testing.T) {
st.ErrorPages(true, h).ServeHTTP(w, nil) st.ErrorPages(true, h).ServeHTTP(w, nil)
w.Flush() w.Flush()
helper.AssertResponseCode(t, w, 404) testhelper.AssertResponseCode(t, w, 404)
helper.AssertResponseBody(t, w, errorPage) testhelper.AssertResponseBody(t, w, errorPage)
} }
func TestIfErrorPassedIfNoErrorPageIsFound(t *testing.T) { func TestIfErrorPassedIfNoErrorPageIsFound(t *testing.T) {
...@@ -51,8 +51,8 @@ func TestIfErrorPassedIfNoErrorPageIsFound(t *testing.T) { ...@@ -51,8 +51,8 @@ func TestIfErrorPassedIfNoErrorPageIsFound(t *testing.T) {
st.ErrorPages(true, h).ServeHTTP(w, nil) st.ErrorPages(true, h).ServeHTTP(w, nil)
w.Flush() w.Flush()
helper.AssertResponseCode(t, w, 404) testhelper.AssertResponseCode(t, w, 404)
helper.AssertResponseBody(t, w, errorResponse) testhelper.AssertResponseBody(t, w, errorResponse)
} }
func TestIfErrorPageIsIgnoredInDevelopment(t *testing.T) { func TestIfErrorPageIsIgnoredInDevelopment(t *testing.T) {
...@@ -74,6 +74,6 @@ func TestIfErrorPageIsIgnoredInDevelopment(t *testing.T) { ...@@ -74,6 +74,6 @@ func TestIfErrorPageIsIgnoredInDevelopment(t *testing.T) {
st := &Static{dir} st := &Static{dir}
st.ErrorPages(false, h).ServeHTTP(w, nil) st.ErrorPages(false, h).ServeHTTP(w, nil)
w.Flush() w.Flush()
helper.AssertResponseCode(t, w, 500) testhelper.AssertResponseCode(t, w, 500)
helper.AssertResponseBody(t, w, serverError) testhelper.AssertResponseBody(t, w, serverError)
} }
package staticpages package staticpages
import ( import (
"../helper" "../testhelper"
"bytes" "bytes"
"compress/gzip" "compress/gzip"
"io/ioutil" "io/ioutil"
...@@ -19,7 +19,7 @@ func TestServingNonExistingFile(t *testing.T) { ...@@ -19,7 +19,7 @@ func TestServingNonExistingFile(t *testing.T) {
w := httptest.NewRecorder() w := httptest.NewRecorder()
st := &Static{dir} st := &Static{dir}
st.ServeExisting("/", CacheDisabled, nil).ServeHTTP(w, httpRequest) st.ServeExisting("/", CacheDisabled, nil).ServeHTTP(w, httpRequest)
helper.AssertResponseCode(t, w, 404) testhelper.AssertResponseCode(t, w, 404)
} }
func TestServingDirectory(t *testing.T) { func TestServingDirectory(t *testing.T) {
...@@ -33,7 +33,7 @@ func TestServingDirectory(t *testing.T) { ...@@ -33,7 +33,7 @@ func TestServingDirectory(t *testing.T) {
w := httptest.NewRecorder() w := httptest.NewRecorder()
st := &Static{dir} st := &Static{dir}
st.ServeExisting("/", CacheDisabled, nil).ServeHTTP(w, httpRequest) st.ServeExisting("/", CacheDisabled, nil).ServeHTTP(w, httpRequest)
helper.AssertResponseCode(t, w, 404) testhelper.AssertResponseCode(t, w, 404)
} }
func TestServingMalformedUri(t *testing.T) { func TestServingMalformedUri(t *testing.T) {
...@@ -43,7 +43,7 @@ func TestServingMalformedUri(t *testing.T) { ...@@ -43,7 +43,7 @@ func TestServingMalformedUri(t *testing.T) {
w := httptest.NewRecorder() w := httptest.NewRecorder()
st := &Static{dir} st := &Static{dir}
st.ServeExisting("/", CacheDisabled, nil).ServeHTTP(w, httpRequest) st.ServeExisting("/", CacheDisabled, nil).ServeHTTP(w, httpRequest)
helper.AssertResponseCode(t, w, 404) testhelper.AssertResponseCode(t, w, 404)
} }
func TestExecutingHandlerWhenNoFileFound(t *testing.T) { func TestExecutingHandlerWhenNoFileFound(t *testing.T) {
...@@ -75,7 +75,7 @@ func TestServingTheActualFile(t *testing.T) { ...@@ -75,7 +75,7 @@ func TestServingTheActualFile(t *testing.T) {
w := httptest.NewRecorder() w := httptest.NewRecorder()
st := &Static{dir} st := &Static{dir}
st.ServeExisting("/", CacheDisabled, nil).ServeHTTP(w, httpRequest) st.ServeExisting("/", CacheDisabled, nil).ServeHTTP(w, httpRequest)
helper.AssertResponseCode(t, w, 200) testhelper.AssertResponseCode(t, w, 200)
if w.Body.String() != fileContent { if w.Body.String() != fileContent {
t.Error("We should serve the file: ", w.Body.String()) t.Error("We should serve the file: ", w.Body.String())
} }
...@@ -107,15 +107,15 @@ func testServingThePregzippedFile(t *testing.T, enableGzip bool) { ...@@ -107,15 +107,15 @@ func testServingThePregzippedFile(t *testing.T, enableGzip bool) {
w := httptest.NewRecorder() w := httptest.NewRecorder()
st := &Static{dir} st := &Static{dir}
st.ServeExisting("/", CacheDisabled, nil).ServeHTTP(w, httpRequest) st.ServeExisting("/", CacheDisabled, nil).ServeHTTP(w, httpRequest)
helper.AssertResponseCode(t, w, 200) testhelper.AssertResponseCode(t, w, 200)
if enableGzip { if enableGzip {
helper.AssertResponseHeader(t, w, "Content-Encoding", "gzip") testhelper.AssertResponseHeader(t, w, "Content-Encoding", "gzip")
if bytes.Compare(w.Body.Bytes(), fileGzipContent.Bytes()) != 0 { if bytes.Compare(w.Body.Bytes(), fileGzipContent.Bytes()) != 0 {
t.Error("We should serve the pregzipped file") t.Error("We should serve the pregzipped file")
} }
} else { } else {
helper.AssertResponseCode(t, w, 200) testhelper.AssertResponseCode(t, w, 200)
helper.AssertResponseHeader(t, w, "Content-Encoding", "") testhelper.AssertResponseHeader(t, w, "Content-Encoding", "")
if w.Body.String() != fileContent { if w.Body.String() != fileContent {
t.Error("We should serve the file: ", w.Body.String()) t.Error("We should serve the file: ", w.Body.String())
} }
......
...@@ -3,6 +3,7 @@ package upload ...@@ -3,6 +3,7 @@ package upload
import ( import (
"../helper" "../helper"
"../proxy" "../proxy"
"../testhelper"
"bytes" "bytes"
"fmt" "fmt"
"io" "io"
...@@ -22,11 +23,11 @@ func TestUploadTempPathRequirement(t *testing.T) { ...@@ -22,11 +23,11 @@ func TestUploadTempPathRequirement(t *testing.T) {
response := httptest.NewRecorder() response := httptest.NewRecorder()
request := &http.Request{} request := &http.Request{}
handleFileUploads(nilHandler).ServeHTTP(response, request) handleFileUploads(nilHandler).ServeHTTP(response, request)
helper.AssertResponseCode(t, response, 500) testhelper.AssertResponseCode(t, response, 500)
} }
func TestUploadHandlerForwardingRawData(t *testing.T) { func TestUploadHandlerForwardingRawData(t *testing.T) {
ts := helper.TestServerWithHandler(regexp.MustCompile(`/url/path\z`), func(w http.ResponseWriter, r *http.Request) { ts := testhelper.TestServerWithHandler(regexp.MustCompile(`/url/path\z`), func(w http.ResponseWriter, r *http.Request) {
if r.Method != "PATCH" { if r.Method != "PATCH" {
t.Fatal("Expected PATCH request") t.Fatal("Expected PATCH request")
} }
...@@ -58,7 +59,7 @@ func TestUploadHandlerForwardingRawData(t *testing.T) { ...@@ -58,7 +59,7 @@ func TestUploadHandlerForwardingRawData(t *testing.T) {
httpRequest.Header.Set(tempPathHeader, tempPath) httpRequest.Header.Set(tempPathHeader, tempPath)
handleFileUploads(proxy.NewProxy(helper.URLMustParse(ts.URL), "123", nil)).ServeHTTP(response, httpRequest) handleFileUploads(proxy.NewProxy(helper.URLMustParse(ts.URL), "123", nil)).ServeHTTP(response, httpRequest)
helper.AssertResponseCode(t, response, 202) testhelper.AssertResponseCode(t, response, 202)
if response.Body.String() != "RESPONSE" { if response.Body.String() != "RESPONSE" {
t.Fatal("Expected RESPONSE in response body") t.Fatal("Expected RESPONSE in response body")
} }
...@@ -73,7 +74,7 @@ func TestUploadHandlerRewritingMultiPartData(t *testing.T) { ...@@ -73,7 +74,7 @@ func TestUploadHandlerRewritingMultiPartData(t *testing.T) {
} }
defer os.RemoveAll(tempPath) defer os.RemoveAll(tempPath)
ts := helper.TestServerWithHandler(regexp.MustCompile(`/url/path\z`), func(w http.ResponseWriter, r *http.Request) { ts := testhelper.TestServerWithHandler(regexp.MustCompile(`/url/path\z`), func(w http.ResponseWriter, r *http.Request) {
if r.Method != "PUT" { if r.Method != "PUT" {
t.Fatal("Expected PUT request") t.Fatal("Expected PUT request")
} }
...@@ -132,7 +133,7 @@ func TestUploadHandlerRewritingMultiPartData(t *testing.T) { ...@@ -132,7 +133,7 @@ func TestUploadHandlerRewritingMultiPartData(t *testing.T) {
response := httptest.NewRecorder() response := httptest.NewRecorder()
handleFileUploads(proxy.NewProxy(helper.URLMustParse(ts.URL), "123", nil)).ServeHTTP(response, httpRequest) handleFileUploads(proxy.NewProxy(helper.URLMustParse(ts.URL), "123", nil)).ServeHTTP(response, httpRequest)
helper.AssertResponseCode(t, response, 202) testhelper.AssertResponseCode(t, response, 202)
if _, err := os.Stat(filePath); !os.IsNotExist(err) { if _, err := os.Stat(filePath); !os.IsNotExist(err) {
t.Fatal("expected the file to be deleted") t.Fatal("expected the file to be deleted")
......
package upstream package upstream
import ( import (
"../helper" "../testhelper"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
"testing" "testing"
...@@ -35,5 +35,5 @@ func TestDevelopmentModeDisabled(t *testing.T) { ...@@ -35,5 +35,5 @@ func TestDevelopmentModeDisabled(t *testing.T) {
if executed { if executed {
t.Error("The handler should not get executed") t.Error("The handler should not get executed")
} }
helper.AssertResponseCode(t, w, 404) testhelper.AssertResponseCode(t, w, 404)
} }
package upstream package upstream
import ( import (
"../helper" "../testhelper"
"bytes" "bytes"
"compress/gzip" "compress/gzip"
"fmt" "fmt"
...@@ -37,7 +37,7 @@ func TestGzipEncoding(t *testing.T) { ...@@ -37,7 +37,7 @@ func TestGzipEncoding(t *testing.T) {
} }
})).ServeHTTP(resp, req) })).ServeHTTP(resp, req)
helper.AssertResponseCode(t, resp, 200) testhelper.AssertResponseCode(t, resp, 200)
} }
func TestNoEncoding(t *testing.T) { func TestNoEncoding(t *testing.T) {
...@@ -61,7 +61,7 @@ func TestNoEncoding(t *testing.T) { ...@@ -61,7 +61,7 @@ func TestNoEncoding(t *testing.T) {
} }
})).ServeHTTP(resp, req) })).ServeHTTP(resp, req)
helper.AssertResponseCode(t, resp, 200) testhelper.AssertResponseCode(t, resp, 200)
} }
func TestInvalidEncoding(t *testing.T) { func TestInvalidEncoding(t *testing.T) {
...@@ -77,5 +77,5 @@ func TestInvalidEncoding(t *testing.T) { ...@@ -77,5 +77,5 @@ func TestInvalidEncoding(t *testing.T) {
t.Fatal("it shouldn't be executed") t.Fatal("it shouldn't be executed")
})).ServeHTTP(resp, req) })).ServeHTTP(resp, req)
helper.AssertResponseCode(t, resp, 500) testhelper.AssertResponseCode(t, resp, 500)
} }
...@@ -3,6 +3,7 @@ package main ...@@ -3,6 +3,7 @@ package main
import ( import (
"./internal/api" "./internal/api"
"./internal/helper" "./internal/helper"
"./internal/testhelper"
"./internal/upstream" "./internal/upstream"
"bytes" "bytes"
"encoding/json" "encoding/json"
...@@ -329,7 +330,7 @@ func TestAllowedStaticFile(t *testing.T) { ...@@ -329,7 +330,7 @@ func TestAllowedStaticFile(t *testing.T) {
} }
proxied := false proxied := false
ts := helper.TestServerWithHandler(regexp.MustCompile(`.`), func(w http.ResponseWriter, r *http.Request) { ts := testhelper.TestServerWithHandler(regexp.MustCompile(`.`), func(w http.ResponseWriter, r *http.Request) {
proxied = true proxied = true
w.WriteHeader(404) w.WriteHeader(404)
}) })
...@@ -369,7 +370,7 @@ func TestAllowedPublicUploadsFile(t *testing.T) { ...@@ -369,7 +370,7 @@ func TestAllowedPublicUploadsFile(t *testing.T) {
} }
proxied := false proxied := false
ts := helper.TestServerWithHandler(regexp.MustCompile(`.`), func(w http.ResponseWriter, r *http.Request) { ts := testhelper.TestServerWithHandler(regexp.MustCompile(`.`), func(w http.ResponseWriter, r *http.Request) {
proxied = true proxied = true
w.Header().Add("X-Sendfile", *documentRoot+r.URL.Path) w.Header().Add("X-Sendfile", *documentRoot+r.URL.Path)
w.WriteHeader(200) w.WriteHeader(200)
...@@ -410,7 +411,7 @@ func TestDeniedPublicUploadsFile(t *testing.T) { ...@@ -410,7 +411,7 @@ func TestDeniedPublicUploadsFile(t *testing.T) {
} }
proxied := false proxied := false
ts := helper.TestServerWithHandler(regexp.MustCompile(`.`), func(w http.ResponseWriter, _ *http.Request) { ts := testhelper.TestServerWithHandler(regexp.MustCompile(`.`), func(w http.ResponseWriter, _ *http.Request) {
proxied = true proxied = true
w.WriteHeader(404) w.WriteHeader(404)
}) })
...@@ -453,7 +454,7 @@ func TestArtifactsUpload(t *testing.T) { ...@@ -453,7 +454,7 @@ func TestArtifactsUpload(t *testing.T) {
fmt.Fprint(file, "SHOULD BE ON DISK, NOT IN MULTIPART") fmt.Fprint(file, "SHOULD BE ON DISK, NOT IN MULTIPART")
writer.Close() writer.Close()
ts := helper.TestServerWithHandler(regexp.MustCompile(`.`), func(w http.ResponseWriter, r *http.Request) { ts := testhelper.TestServerWithHandler(regexp.MustCompile(`.`), func(w http.ResponseWriter, r *http.Request) {
if strings.HasSuffix(r.URL.Path, "/authorize") { if strings.HasSuffix(r.URL.Path, "/authorize") {
if _, err := fmt.Fprintf(w, `{"TempPath":"%s"}`, scratchDir); err != nil { if _, err := fmt.Fprintf(w, `{"TempPath":"%s"}`, scratchDir); err != nil {
t.Fatal(err) t.Fatal(err)
...@@ -525,7 +526,7 @@ func newBranch() string { ...@@ -525,7 +526,7 @@ func newBranch() string {
} }
func testAuthServer(url *regexp.Regexp, code int, body interface{}) *httptest.Server { func testAuthServer(url *regexp.Regexp, code int, body interface{}) *httptest.Server {
return helper.TestServerWithHandler(url, func(w http.ResponseWriter, r *http.Request) { return testhelper.TestServerWithHandler(url, func(w http.ResponseWriter, r *http.Request) {
// Write pure string // Write pure string
if data, ok := body.(string); ok { if data, ok := body.(string); ok {
log.Println("UPSTREAM", r.Method, r.URL, code) log.Println("UPSTREAM", r.Method, r.URL, code)
......
...@@ -4,6 +4,7 @@ import ( ...@@ -4,6 +4,7 @@ import (
"./internal/badgateway" "./internal/badgateway"
"./internal/helper" "./internal/helper"
"./internal/proxy" "./internal/proxy"
"./internal/testhelper"
"bytes" "bytes"
"fmt" "fmt"
"io" "io"
...@@ -20,7 +21,7 @@ func newProxy(url string, rt *badgateway.RoundTripper) *proxy.Proxy { ...@@ -20,7 +21,7 @@ func newProxy(url string, rt *badgateway.RoundTripper) *proxy.Proxy {
} }
func TestProxyRequest(t *testing.T) { func TestProxyRequest(t *testing.T) {
ts := helper.TestServerWithHandler(regexp.MustCompile(`/url/path\z`), func(w http.ResponseWriter, r *http.Request) { ts := testhelper.TestServerWithHandler(regexp.MustCompile(`/url/path\z`), func(w http.ResponseWriter, r *http.Request) {
if r.Method != "POST" { if r.Method != "POST" {
t.Fatal("Expected POST request") t.Fatal("Expected POST request")
} }
...@@ -48,8 +49,8 @@ func TestProxyRequest(t *testing.T) { ...@@ -48,8 +49,8 @@ func TestProxyRequest(t *testing.T) {
w := httptest.NewRecorder() w := httptest.NewRecorder()
newProxy(ts.URL, nil).ServeHTTP(w, httpRequest) newProxy(ts.URL, nil).ServeHTTP(w, httpRequest)
helper.AssertResponseCode(t, w, 202) testhelper.AssertResponseCode(t, w, 202)
helper.AssertResponseBody(t, w, "RESPONSE") testhelper.AssertResponseBody(t, w, "RESPONSE")
if w.Header().Get("Custom-Response-Header") != "test" { if w.Header().Get("Custom-Response-Header") != "test" {
t.Fatal("Expected custom response header") t.Fatal("Expected custom response header")
...@@ -65,12 +66,12 @@ func TestProxyError(t *testing.T) { ...@@ -65,12 +66,12 @@ 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)
helper.AssertResponseCode(t, w, 502) testhelper.AssertResponseCode(t, w, 502)
helper.AssertResponseBody(t, w, "dial tcp: invalid port 655575") testhelper.AssertResponseBody(t, w, "dial tcp: invalid port 655575")
} }
func TestProxyReadTimeout(t *testing.T) { func TestProxyReadTimeout(t *testing.T) {
ts := helper.TestServerWithHandler(nil, func(w http.ResponseWriter, r *http.Request) { ts := testhelper.TestServerWithHandler(nil, func(w http.ResponseWriter, r *http.Request) {
time.Sleep(time.Minute) time.Sleep(time.Minute)
}) })
...@@ -94,12 +95,12 @@ func TestProxyReadTimeout(t *testing.T) { ...@@ -94,12 +95,12 @@ func TestProxyReadTimeout(t *testing.T) {
p := newProxy(ts.URL, rt) p := newProxy(ts.URL, rt)
w := httptest.NewRecorder() w := httptest.NewRecorder()
p.ServeHTTP(w, httpRequest) p.ServeHTTP(w, httpRequest)
helper.AssertResponseCode(t, w, 502) testhelper.AssertResponseCode(t, w, 502)
helper.AssertResponseBody(t, w, "net/http: timeout awaiting response headers") testhelper.AssertResponseBody(t, w, "net/http: timeout awaiting response headers")
} }
func TestProxyHandlerTimeout(t *testing.T) { func TestProxyHandlerTimeout(t *testing.T) {
ts := helper.TestServerWithHandler(nil, ts := testhelper.TestServerWithHandler(nil,
http.TimeoutHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { http.TimeoutHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
time.Sleep(time.Second) time.Sleep(time.Second)
}), time.Millisecond, "Request took too long").ServeHTTP, }), time.Millisecond, "Request took too long").ServeHTTP,
...@@ -112,6 +113,6 @@ func TestProxyHandlerTimeout(t *testing.T) { ...@@ -112,6 +113,6 @@ func TestProxyHandlerTimeout(t *testing.T) {
w := httptest.NewRecorder() w := httptest.NewRecorder()
newProxy(ts.URL, nil).ServeHTTP(w, httpRequest) newProxy(ts.URL, nil).ServeHTTP(w, httpRequest)
helper.AssertResponseCode(t, w, 503) testhelper.AssertResponseCode(t, w, 503)
helper.AssertResponseBody(t, w, "Request took too long") testhelper.AssertResponseBody(t, w, "Request took too long")
} }
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