diff options
author | Jaime Martinez <jmartinez@gitlab.com> | 2020-09-14 04:29:20 +0300 |
---|---|---|
committer | Jaime Martinez <jmartinez@gitlab.com> | 2020-09-15 07:49:29 +0300 |
commit | 6fa2497adfcb2a3ce8b119b7caa6a1f0ff4a30f9 (patch) | |
tree | cb7492862834b58e10c1e6fd4843d1cdf5c27820 /helpers_test.go | |
parent | 297d3a48c553b54093462068ff28543236be6649 (diff) |
Move setup to helper function
Diffstat (limited to 'helpers_test.go')
-rw-r--r-- | helpers_test.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/helpers_test.go b/helpers_test.go index 926fc372..d08869fd 100644 --- a/helpers_test.go +++ b/helpers_test.go @@ -163,6 +163,21 @@ func RunPagesProcessWithEnvs(t *testing.T, wait bool, pagesPath string, listener return runPagesProcess(t, wait, pagesPath, listeners, promPort, envs, extraArgs...) } +func RunPagesProcessWithStubGitLabServer(t *testing.T, wait bool, pagesPath string, listeners []ListenSpec, promPort string, envs []string, extraArgs ...string) (teardown func()) { + var apiCalled bool + source := NewGitlabDomainsSourceStub(t, &apiCalled) + + gitLabAPISecretKey := CreateGitLabAPISecretKeyFixtureFile(t) + pagesArgs := append([]string{"-gitlab-server", source.URL, "-api-secret-key", gitLabAPISecretKey, "-domain-config-source", "gitlab"}, extraArgs...) + + cleanup := runPagesProcess(t, wait, pagesPath, listeners, promPort, envs, pagesArgs...) + + return func() { + source.Close() + cleanup() + } +} + func RunPagesProcessWithAuth(t *testing.T, pagesPath string, listeners []ListenSpec, promPort string) func() { configFile, cleanup := defaultConfigFileWith(t, "auth-server=https://gitlab-auth.com", |