diff options
author | Jaime Martinez <jmartinez@gitlab.com> | 2020-08-28 08:22:46 +0300 |
---|---|---|
committer | Jaime Martinez <jmartinez@gitlab.com> | 2020-08-28 08:28:40 +0300 |
commit | a49524dc7d9c664a48bbd62c11591637e4209e5b (patch) | |
tree | b08b186f3b410e524ae14fa306109c1e5c0abf8d /helpers_test.go | |
parent | 9474a11af3f797d1fc6da71f929669faa9426b1d (diff) |
Convert TestDomainSource to table test
Take apiCalled as arg
Diffstat (limited to 'helpers_test.go')
-rw-r--r-- | helpers_test.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/helpers_test.go b/helpers_test.go index 16032c38..926fc372 100644 --- a/helpers_test.go +++ b/helpers_test.go @@ -420,15 +420,15 @@ func waitForRoundtrips(t *testing.T, listeners []ListenSpec, timeout time.Durati require.Equal(t, len(listeners), nListening, "all listeners must be accepting TCP connections") } -func NewGitlabDomainsSourceStub(t *testing.T) (*httptest.Server, *bool) { - called := false +func NewGitlabDomainsSourceStub(t *testing.T, apiCalled *bool) *httptest.Server { + *apiCalled = false mux := http.NewServeMux() mux.HandleFunc("/api/v4/internal/pages/status", func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusNoContent) }) handler := func(w http.ResponseWriter, r *http.Request) { - called = true + *apiCalled = true domain := r.URL.Query().Get("host") path := "shared/lookups/" + domain + ".json" @@ -450,7 +450,7 @@ func NewGitlabDomainsSourceStub(t *testing.T) (*httptest.Server, *bool) { } mux.HandleFunc("/api/v4/internal/pages", handler) - return httptest.NewServer(mux), &called + return httptest.NewServer(mux) } func newConfigFile(configs ...string) (string, error) { |