Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaime Martinez <jmartinez@gitlab.com>2021-06-10 08:27:25 +0300
committerJaime Martinez <jmartinez@gitlab.com>2021-06-10 08:27:25 +0300
commit42a66cca56f910e3d867f876753c32d176d6c942 (patch)
treed37c0f7753d64b750d34bc595aa43bbef22d1b2d
parent8dd9d1cadcedb9e441fe5dc4c3249eaf274caec6 (diff)
Update test config
-rw-r--r--test/acceptance/config_test.go22
-rw-r--r--test/acceptance/helpers_test.go2
-rw-r--r--test/acceptance/stub_test.go4
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