diff options
Diffstat (limited to 'test/acceptance')
-rw-r--r-- | test/acceptance/config_test.go | 22 | ||||
-rw-r--r-- | test/acceptance/helpers_test.go | 2 | ||||
-rw-r--r-- | test/acceptance/stub_test.go | 4 |
3 files changed, 20 insertions, 8 deletions
diff --git a/test/acceptance/config_test.go b/test/acceptance/config_test.go index 5db00696..aa568969 100644 --- a/test/acceptance/config_test.go +++ b/test/acceptance/config_test.go @@ -14,9 +14,11 @@ func TestEnvironmentVariablesConfig(t *testing.T) { envVarValue := "LISTEN_HTTP=" + net.JoinHostPort(httpListener.Host, httpListener.Port) - _, teardown := RunPagesProcessWithStubGitLabServer(t, false, *pagesBinary, []ListenSpec{}, []string{envVarValue}) - defer teardown() - + RunPagesProcessWithStubGitLabServer(t, + withoutWait, + withListeners([]ListenSpec{}), // explicitly disable listeners for this test + withEnv([]string{envVarValue}), + ) require.NoError(t, httpListener.WaitUntilRequestSucceeds(nil)) rsp, err := GetPageFromListener(t, httpListener, "group.gitlab-example.com:", "project/") @@ -30,8 +32,11 @@ func TestMixedConfigSources(t *testing.T) { skipUnlessEnabled(t) envVarValue := "LISTEN_HTTP=" + net.JoinHostPort(httpListener.Host, httpListener.Port) - _, teardown := RunPagesProcessWithStubGitLabServer(t, false, *pagesBinary, []ListenSpec{httpsListener}, []string{envVarValue}) - defer teardown() + RunPagesProcessWithStubGitLabServer(t, + withoutWait, + withListeners([]ListenSpec{httpsListener}), + withEnv([]string{envVarValue}), + ) for _, listener := range []ListenSpec{httpListener, httpsListener} { require.NoError(t, listener.WaitUntilRequestSucceeds(nil)) @@ -49,8 +54,11 @@ func TestMultipleListenersFromEnvironmentVariables(t *testing.T) { listenSpecs := []ListenSpec{{"http", "127.0.0.1", "37001"}, {"http", "127.0.0.1", "37002"}} envVarValue := fmt.Sprintf("LISTEN_HTTP=%s,%s", net.JoinHostPort("127.0.0.1", "37001"), net.JoinHostPort("127.0.0.1", "37002")) - _, teardown := RunPagesProcessWithStubGitLabServer(t, false, *pagesBinary, []ListenSpec{}, []string{envVarValue}) - defer teardown() + RunPagesProcessWithStubGitLabServer(t, + withoutWait, + withListeners([]ListenSpec{}), // explicitly disable listeners for this test + withEnv([]string{envVarValue}), + ) for _, listener := range listenSpecs { require.NoError(t, listener.WaitUntilRequestSucceeds(nil)) diff --git a/test/acceptance/helpers_test.go b/test/acceptance/helpers_test.go index ec712b6d..e9ae6a96 100644 --- a/test/acceptance/helpers_test.go +++ b/test/acceptance/helpers_test.go @@ -255,7 +255,7 @@ func RunPagesProcessWithStubGitLabServer(t *testing.T, opts ...processOption) *L gitLabAPISecretKey := CreateGitLabAPISecretKeyFixtureFile(t) processCfg.extraArgs = append(processCfg.extraArgs, "-pages-root", wd, "-gitlab-server", source.URL, "-api-secret-key", gitLabAPISecretKey, "-domain-config-source", "gitlab") - logBuf, cleanup := runPagesProcess(t, processCfg.wait, processCfg.pagesBinary, listeners, "", processCfg.envs, processCfg.extraArgs...) + logBuf, cleanup := runPagesProcess(t, processCfg.wait, processCfg.pagesBinary, processCfg.listeners, "", processCfg.envs, processCfg.extraArgs...) t.Cleanup(func() { source.Close() diff --git a/test/acceptance/stub_test.go b/test/acceptance/stub_test.go index 2ba7da41..3fcb179d 100644 --- a/test/acceptance/stub_test.go +++ b/test/acceptance/stub_test.go @@ -32,6 +32,10 @@ type processConfig struct { type processOption func(*processConfig) +func withoutWait(config *processConfig) { + config.wait = false +} + func withListeners(listeners []ListenSpec) processOption { return func(config *processConfig) { config.listeners = listeners |