diff options
author | feistel <6742251-feistel@users.noreply.gitlab.com> | 2021-04-22 03:05:04 +0300 |
---|---|---|
committer | feistel <6742251-feistel@users.noreply.gitlab.com> | 2021-04-22 03:05:04 +0300 |
commit | 626417a23a29ee4852a1cc1d267c54f5cb6f399e (patch) | |
tree | b5fffc9f508debdef0236b40e506cfde0303410e /test/acceptance | |
parent | 7250a994989f44c8bc3b83f60cba564cd3c3a74e (diff) |
Fix acceptance tests not running on IPv4-only systems
Diffstat (limited to 'test/acceptance')
-rw-r--r-- | test/acceptance/acceptance_test.go | 6 | ||||
-rw-r--r-- | test/acceptance/acme_test.go | 4 | ||||
-rw-r--r-- | test/acceptance/artifacts_test.go | 4 | ||||
-rw-r--r-- | test/acceptance/auth_test.go | 24 | ||||
-rw-r--r-- | test/acceptance/encodings_test.go | 4 | ||||
-rw-r--r-- | test/acceptance/helpers_test.go | 14 | ||||
-rw-r--r-- | test/acceptance/metrics_test.go | 2 | ||||
-rw-r--r-- | test/acceptance/proxyv2_test.go | 2 | ||||
-rw-r--r-- | test/acceptance/redirects_test.go | 6 | ||||
-rw-r--r-- | test/acceptance/serving_test.go | 61 | ||||
-rw-r--r-- | test/acceptance/status_test.go | 10 | ||||
-rw-r--r-- | test/acceptance/tls_test.go | 8 | ||||
-rw-r--r-- | test/acceptance/unknown_http_method_test.go | 4 | ||||
-rw-r--r-- | test/acceptance/zip_test.go | 6 |
14 files changed, 84 insertions, 71 deletions
diff --git a/test/acceptance/acceptance_test.go b/test/acceptance/acceptance_test.go index 1b1c5d05..e88d7a71 100644 --- a/test/acceptance/acceptance_test.go +++ b/test/acceptance/acceptance_test.go @@ -35,6 +35,12 @@ var ( {"https-proxyv2", "127.0.0.1", httpProxyV2Port}, {"https-proxyv2", "::1", httpProxyV2Port}, } + ipv4Listeners = []ListenSpec{ + listeners[0], + listeners[2], + listeners[4], + listeners[6], + } httpListener = listeners[0] httpsListener = listeners[2] diff --git a/test/acceptance/acme_test.go b/test/acceptance/acme_test.go index a0425b7d..df4227b0 100644 --- a/test/acceptance/acme_test.go +++ b/test/acceptance/acme_test.go @@ -12,7 +12,7 @@ import ( func TestAcmeChallengesWhenItIsNotConfigured(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, listeners, "", "") + teardown := RunPagesProcess(t, *pagesBinary, SupportedListeners(), "", "") defer teardown() t.Run("When domain folder contains requested acme challenge it responds with it", func(t *testing.T) { @@ -41,7 +41,7 @@ func TestAcmeChallengesWhenItIsNotConfigured(t *testing.T) { func TestAcmeChallengesWhenItIsConfigured(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, listeners, "", "-gitlab-server=https://gitlab-acme.com") + teardown := RunPagesProcess(t, *pagesBinary, SupportedListeners(), "", "-gitlab-server=https://gitlab-acme.com") defer teardown() t.Run("When domain folder contains requested acme challenge it responds with it", func(t *testing.T) { diff --git a/test/acceptance/artifacts_test.go b/test/acceptance/artifacts_test.go index 57c7a02a..ff44d4d2 100644 --- a/test/acceptance/artifacts_test.go +++ b/test/acceptance/artifacts_test.go @@ -134,7 +134,7 @@ func TestArtifactProxyRequest(t *testing.T) { teardown := RunPagesProcessWithSSLCertFile( t, *pagesBinary, - listeners, + SupportedListeners(), "", certFile, "-artifacts-server="+artifactServerURL, @@ -238,7 +238,7 @@ func TestPrivateArtifactProxyRequest(t *testing.T) { teardown := RunPagesProcessWithSSLCertFile( t, *pagesBinary, - listeners, + SupportedListeners(), "", certFile, "-config="+configFile, diff --git a/test/acceptance/auth_test.go b/test/acceptance/auth_test.go index 1e2ec481..7c444221 100644 --- a/test/acceptance/auth_test.go +++ b/test/acceptance/auth_test.go @@ -16,7 +16,7 @@ import ( func TestWhenAuthIsDisabledPrivateIsNotAccessible(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, listeners, "", "") + teardown := RunPagesProcess(t, *pagesBinary, SupportedListeners(), "", "") defer teardown() rsp, err := GetPageFromListener(t, httpListener, "group.auth.gitlab-example.com", "private.project/") @@ -28,7 +28,7 @@ func TestWhenAuthIsDisabledPrivateIsNotAccessible(t *testing.T) { func TestWhenAuthIsEnabledPrivateWillRedirectToAuthorize(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcessWithAuth(t, *pagesBinary, listeners, "") + teardown := RunPagesProcessWithAuth(t, *pagesBinary, SupportedListeners(), "") defer teardown() rsp, err := GetRedirectPage(t, httpsListener, "group.auth.gitlab-example.com", "private.project/") @@ -60,7 +60,7 @@ func TestWhenAuthIsEnabledPrivateWillRedirectToAuthorize(t *testing.T) { func TestWhenAuthDeniedWillCauseUnauthorized(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcessWithAuth(t, *pagesBinary, listeners, "") + teardown := RunPagesProcessWithAuth(t, *pagesBinary, SupportedListeners(), "") defer teardown() rsp, err := GetPageFromListener(t, httpsListener, "projects.gitlab-example.com", "/auth?error=access_denied") @@ -72,7 +72,7 @@ func TestWhenAuthDeniedWillCauseUnauthorized(t *testing.T) { } func TestWhenLoginCallbackWithWrongStateShouldFail(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcessWithAuth(t, *pagesBinary, listeners, "") + teardown := RunPagesProcessWithAuth(t, *pagesBinary, SupportedListeners(), "") defer teardown() rsp, err := GetRedirectPage(t, httpsListener, "group.auth.gitlab-example.com", "private.project/") @@ -91,7 +91,7 @@ func TestWhenLoginCallbackWithWrongStateShouldFail(t *testing.T) { func TestWhenLoginCallbackWithUnencryptedCode(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcessWithAuth(t, *pagesBinary, listeners, "") + teardown := RunPagesProcessWithAuth(t, *pagesBinary, SupportedListeners(), "") defer teardown() rsp, err := GetRedirectPage(t, httpsListener, "group.auth.gitlab-example.com", "private.project/") @@ -187,7 +187,7 @@ func TestAccessControlUnderCustomDomain(t *testing.T) { testServer.Start() defer testServer.Close() - teardown := RunPagesProcessWithAuthServer(t, *pagesBinary, listeners, "", testServer.URL) + teardown := RunPagesProcessWithAuthServer(t, *pagesBinary, SupportedListeners(), "", testServer.URL) defer teardown() tests := map[string]struct { @@ -268,7 +268,7 @@ func TestCustomErrorPageWithAuth(t *testing.T) { testServer.Start() defer testServer.Close() - teardown := RunPagesProcessWithAuthServer(t, *pagesBinary, listeners, "", testServer.URL) + teardown := RunPagesProcessWithAuthServer(t, *pagesBinary, SupportedListeners(), "", testServer.URL) defer teardown() tests := []struct { @@ -378,7 +378,7 @@ func TestAccessControlUnderCustomDomainWithHTTPSProxy(t *testing.T) { testServer.Start() defer testServer.Close() - teardown := RunPagesProcessWithAuthServer(t, *pagesBinary, listeners, "", testServer.URL) + teardown := RunPagesProcessWithAuthServer(t, *pagesBinary, SupportedListeners(), "", testServer.URL) defer teardown() rsp, err := GetProxyRedirectPageWithCookie(t, proxyListener, "private.domain.com", "/", "", true) @@ -441,7 +441,7 @@ func TestAccessControlUnderCustomDomainWithHTTPSProxy(t *testing.T) { func TestAccessControlGroupDomain404RedirectsAuth(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcessWithAuth(t, *pagesBinary, listeners, "") + teardown := RunPagesProcessWithAuth(t, *pagesBinary, SupportedListeners(), "") defer teardown() rsp, err := GetRedirectPage(t, httpListener, "group.gitlab-example.com", "/nonexistent/") @@ -456,7 +456,7 @@ func TestAccessControlGroupDomain404RedirectsAuth(t *testing.T) { } func TestAccessControlProject404DoesNotRedirect(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcessWithAuth(t, *pagesBinary, listeners, "") + teardown := RunPagesProcessWithAuth(t, *pagesBinary, SupportedListeners(), "") defer teardown() rsp, err := GetRedirectPage(t, httpListener, "group.gitlab-example.com", "/project/nonexistent/") @@ -572,7 +572,7 @@ func testAccessControl(t *testing.T, runPages runPagesFunc) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - teardown := runPages(t, *pagesBinary, listeners, "", certFile, testServer.URL) + teardown := runPages(t, *pagesBinary, SupportedListeners(), "", certFile, testServer.URL) defer teardown() rsp, err := GetRedirectPage(t, httpsListener, tt.host, tt.path) @@ -656,7 +656,7 @@ func TestHijackedCode(t *testing.T) { testServer.Start() defer testServer.Close() - teardown := RunPagesProcessWithAuthServer(t, *pagesBinary, listeners, "", testServer.URL) + teardown := RunPagesProcessWithAuthServer(t, *pagesBinary, SupportedListeners(), "", testServer.URL) defer teardown() /****ATTACKER******/ diff --git a/test/acceptance/encodings_test.go b/test/acceptance/encodings_test.go index 9b874205..af7046ba 100644 --- a/test/acceptance/encodings_test.go +++ b/test/acceptance/encodings_test.go @@ -10,7 +10,7 @@ import ( func TestMIMETypes(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcessWithoutWait(t, *pagesBinary, listeners, "") + teardown := RunPagesProcessWithoutWait(t, *pagesBinary, SupportedListeners(), "") defer teardown() require.NoError(t, httpListener.WaitUntilRequestSucceeds(nil)) @@ -62,7 +62,7 @@ func TestCompressedEncoding(t *testing.T) { }, } - teardown := RunPagesProcess(t, *pagesBinary, listeners, "") + teardown := RunPagesProcess(t, *pagesBinary, SupportedListeners(), "") defer teardown() for _, tt := range tests { diff --git a/test/acceptance/helpers_test.go b/test/acceptance/helpers_test.go index d2c3c31e..cc27299e 100644 --- a/test/acceptance/helpers_test.go +++ b/test/acceptance/helpers_test.go @@ -22,6 +22,7 @@ import ( "github.com/pires/go-proxyproto" "github.com/stretchr/testify/require" + "golang.org/x/net/nettest" "gitlab.com/gitlab-org/gitlab-pages/internal/request" "gitlab.com/gitlab-org/gitlab-pages/test/acceptance/testdata" @@ -142,6 +143,13 @@ type ListenSpec struct { Port string } +func SupportedListeners() []ListenSpec { + if !nettest.SupportsIPv6() { + return ipv4Listeners + } + return listeners +} + func (l ListenSpec) URL(suffix string) string { scheme := request.SchemeHTTP if l.Type == request.SchemeHTTPS || l.Type == "https-proxyv2" { @@ -319,7 +327,7 @@ func runPagesProcess(t *testing.T, wait bool, pagesBinary string, listeners []Li } if wait { - for _, spec := range listeners { + for _, spec := range SupportedListeners() { if err := spec.WaitUntilRequestSucceeds(waitCh); err != nil { cleanup() t.Fatal(err) @@ -335,7 +343,7 @@ func getPagesArgs(t *testing.T, listeners []ListenSpec, promPort string, extraAr args = append(args, "-log-verbose=true") - for _, spec := range listeners { + for _, spec := range SupportedListeners() { args = append(args, "-listen-"+spec.Type, spec.JoinHostPort()) if spec.Type == request.SchemeHTTPS { @@ -519,7 +527,7 @@ func ClientWithConfig(tlsConfig *tls.Config) (*http.Client, func()) { func waitForRoundtrips(t *testing.T, listeners []ListenSpec, timeout time.Duration) { nListening := 0 start := time.Now() - for _, spec := range listeners { + for _, spec := range SupportedListeners() { for time.Since(start) < timeout { req, err := http.NewRequest("GET", spec.URL("/"), nil) if err != nil { diff --git a/test/acceptance/metrics_test.go b/test/acceptance/metrics_test.go index 634610a4..f2e30d06 100644 --- a/test/acceptance/metrics_test.go +++ b/test/acceptance/metrics_test.go @@ -14,7 +14,7 @@ func TestPrometheusMetricsCanBeScraped(t *testing.T) { _, cleanup := newZipFileServerURL(t, "../../shared/pages/group/zip.gitlab.io/public.zip") defer cleanup() - teardown := RunPagesProcessWithStubGitLabServer(t, true, *pagesBinary, listeners, ":42345", []string{}, "-max-conns=10") + teardown := RunPagesProcessWithStubGitLabServer(t, true, *pagesBinary, SupportedListeners(), ":42345", []string{}, "-max-conns=10") defer teardown() // need to call an actual resource to populate certain metrics e.g. gitlab_pages_domains_source_api_requests_total diff --git a/test/acceptance/proxyv2_test.go b/test/acceptance/proxyv2_test.go index 2a42f0f1..5c010684 100644 --- a/test/acceptance/proxyv2_test.go +++ b/test/acceptance/proxyv2_test.go @@ -12,7 +12,7 @@ import ( func TestProxyv2(t *testing.T) { skipUnlessEnabled(t) - logBuf, teardown := RunPagesProcessWithOutput(t, *pagesBinary, listeners, "") + logBuf, teardown := RunPagesProcessWithOutput(t, *pagesBinary, SupportedListeners(), "") defer teardown() // the dummy client IP 10.1.1.1 is set by TestProxyv2Client diff --git a/test/acceptance/redirects_test.go b/test/acceptance/redirects_test.go index 6c564ce6..425b017b 100644 --- a/test/acceptance/redirects_test.go +++ b/test/acceptance/redirects_test.go @@ -12,7 +12,7 @@ import ( func TestDisabledRedirects(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcessWithEnvs(t, true, *pagesBinary, listeners, "", []string{"FF_ENABLE_REDIRECTS=false"}) + teardown := RunPagesProcessWithEnvs(t, true, *pagesBinary, SupportedListeners(), "", []string{"FF_ENABLE_REDIRECTS=false"}) defer teardown() // Test that redirects status page is forbidden @@ -33,7 +33,7 @@ func TestDisabledRedirects(t *testing.T) { func TestRedirectStatusPage(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, listeners, "") + teardown := RunPagesProcess(t, *pagesBinary, SupportedListeners(), "") defer teardown() rsp, err := GetPageFromListener(t, httpListener, "group.redirects.gitlab-example.com", "/project-redirects/_redirects") @@ -50,7 +50,7 @@ func TestRedirectStatusPage(t *testing.T) { func TestRedirect(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, listeners, "") + teardown := RunPagesProcess(t, *pagesBinary, SupportedListeners(), "") defer teardown() // Test that serving a file still works with redirects enabled diff --git a/test/acceptance/serving_test.go b/test/acceptance/serving_test.go index 7824dda9..399345b3 100644 --- a/test/acceptance/serving_test.go +++ b/test/acceptance/serving_test.go @@ -16,10 +16,10 @@ import ( func TestUnknownHostReturnsNotFound(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, listeners, "") + teardown := RunPagesProcess(t, *pagesBinary, SupportedListeners(), "") defer teardown() - for _, spec := range listeners { + for _, spec := range SupportedListeners() { rsp, err := GetPageFromListener(t, spec, "invalid.invalid", "") require.NoError(t, err) @@ -30,7 +30,7 @@ func TestUnknownHostReturnsNotFound(t *testing.T) { func TestUnknownProjectReturnsNotFound(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, listeners, "") + teardown := RunPagesProcess(t, *pagesBinary, SupportedListeners(), "") defer teardown() rsp, err := GetPageFromListener(t, httpListener, "group.gitlab-example.com", "/nonexistent/") @@ -41,7 +41,7 @@ func TestUnknownProjectReturnsNotFound(t *testing.T) { func TestGroupDomainReturns200(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, listeners, "") + teardown := RunPagesProcess(t, *pagesBinary, SupportedListeners(), "") defer teardown() rsp, err := GetPageFromListener(t, httpListener, "group.gitlab-example.com", "/") @@ -52,7 +52,7 @@ func TestGroupDomainReturns200(t *testing.T) { func TestKnownHostReturns200(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, listeners, "") + teardown := RunPagesProcess(t, *pagesBinary, SupportedListeners(), "") defer teardown() tests := []struct { @@ -89,7 +89,7 @@ func TestKnownHostReturns200(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - for _, spec := range listeners { + for _, spec := range SupportedListeners() { rsp, err := GetPageFromListener(t, spec, tt.host, tt.path) require.NoError(t, err) @@ -126,12 +126,12 @@ func TestNestedSubgroups(t *testing.T) { makeProjectIndex(subGroupPath) } - teardown := RunPagesProcess(t, *pagesBinary, listeners, "", "-pages-root", pagesRoot) + teardown := RunPagesProcess(t, *pagesBinary, SupportedListeners(), "", "-pages-root", pagesRoot) defer teardown() for nestingLevel, path := range paths { t.Run(fmt.Sprintf("nested level %d", nestingLevel), func(t *testing.T) { - for _, spec := range listeners { + for _, spec := range SupportedListeners() { rsp, err := GetPageFromListener(t, spec, "nested.gitlab-example.com", path+"project/") require.NoError(t, err) @@ -148,7 +148,7 @@ func TestNestedSubgroups(t *testing.T) { func TestCustom404(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, listeners, "") + teardown := RunPagesProcess(t, *pagesBinary, SupportedListeners(), "") defer teardown() tests := []struct { @@ -193,7 +193,7 @@ func TestCustom404(t *testing.T) { for _, test := range tests { t.Run(fmt.Sprintf("%s/%s", test.host, test.path), func(t *testing.T) { - for _, spec := range listeners { + for _, spec := range SupportedListeners() { rsp, err := GetPageFromListener(t, spec, test.host, test.path) require.NoError(t, err) @@ -210,10 +210,10 @@ func TestCustom404(t *testing.T) { func TestCORSWhenDisabled(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, listeners, "", "-disable-cross-origin-requests") + teardown := RunPagesProcess(t, *pagesBinary, SupportedListeners(), "", "-disable-cross-origin-requests") defer teardown() - for _, spec := range listeners { + for _, spec := range SupportedListeners() { for _, method := range []string{"GET", "OPTIONS"} { rsp := doCrossOriginRequest(t, spec, method, method, spec.URL("project/")) @@ -226,10 +226,10 @@ func TestCORSWhenDisabled(t *testing.T) { func TestCORSAllowsGET(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, listeners, "") + teardown := RunPagesProcess(t, *pagesBinary, SupportedListeners(), "") defer teardown() - for _, spec := range listeners { + for _, spec := range SupportedListeners() { for _, method := range []string{"GET", "OPTIONS"} { rsp := doCrossOriginRequest(t, spec, method, method, spec.URL("project/")) @@ -243,10 +243,10 @@ func TestCORSAllowsGET(t *testing.T) { func TestCORSForbidsPOST(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, listeners, "") + teardown := RunPagesProcess(t, *pagesBinary, SupportedListeners(), "") defer teardown() - for _, spec := range listeners { + for _, spec := range SupportedListeners() { rsp := doCrossOriginRequest(t, spec, "OPTIONS", "POST", spec.URL("project/")) require.Equal(t, http.StatusOK, rsp.StatusCode) @@ -258,10 +258,10 @@ func TestCORSForbidsPOST(t *testing.T) { func TestCustomHeaders(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, listeners, "", "-header", "X-Test1:Testing1", "-header", "X-Test2:Testing2") + teardown := RunPagesProcess(t, *pagesBinary, SupportedListeners(), "", "-header", "X-Test1:Testing1", "-header", "X-Test2:Testing2") defer teardown() - for _, spec := range listeners { + for _, spec := range SupportedListeners() { rsp, err := GetPageFromListener(t, spec, "group.gitlab-example.com:", "project/") require.NoError(t, err) require.Equal(t, http.StatusOK, rsp.StatusCode) @@ -273,10 +273,10 @@ func TestCustomHeaders(t *testing.T) { func TestKnownHostWithPortReturns200(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, listeners, "") + teardown := RunPagesProcess(t, *pagesBinary, SupportedListeners(), "") defer teardown() - for _, spec := range listeners { + for _, spec := range SupportedListeners() { rsp, err := GetPageFromListener(t, spec, "group.gitlab-example.com:"+spec.Port, "project/") require.NoError(t, err) @@ -287,7 +287,7 @@ func TestKnownHostWithPortReturns200(t *testing.T) { func TestHttpToHttpsRedirectDisabled(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, listeners, "") + teardown := RunPagesProcess(t, *pagesBinary, SupportedListeners(), "") defer teardown() rsp, err := GetRedirectPage(t, httpListener, "group.gitlab-example.com", "project/") @@ -303,7 +303,7 @@ func TestHttpToHttpsRedirectDisabled(t *testing.T) { func TestHttpToHttpsRedirectEnabled(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, listeners, "", "-redirect-http=true") + teardown := RunPagesProcess(t, *pagesBinary, SupportedListeners(), "", "-redirect-http=true") defer teardown() rsp, err := GetRedirectPage(t, httpListener, "group.gitlab-example.com", "project/") @@ -321,7 +321,7 @@ func TestHttpToHttpsRedirectEnabled(t *testing.T) { func TestHttpsOnlyGroupEnabled(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, listeners, "") + teardown := RunPagesProcess(t, *pagesBinary, SupportedListeners(), "") defer teardown() rsp, err := GetRedirectPage(t, httpListener, "group.https-only.gitlab-example.com", "project1/") @@ -332,7 +332,7 @@ func TestHttpsOnlyGroupEnabled(t *testing.T) { func TestHttpsOnlyGroupDisabled(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, listeners, "") + teardown := RunPagesProcess(t, *pagesBinary, SupportedListeners(), "") defer teardown() rsp, err := GetPageFromListener(t, httpListener, "group.https-only.gitlab-example.com", "project2/") @@ -343,7 +343,7 @@ func TestHttpsOnlyGroupDisabled(t *testing.T) { func TestHttpsOnlyProjectEnabled(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, listeners, "") + teardown := RunPagesProcess(t, *pagesBinary, SupportedListeners(), "") defer teardown() rsp, err := GetRedirectPage(t, httpListener, "test.my-domain.com", "/index.html") @@ -354,7 +354,7 @@ func TestHttpsOnlyProjectEnabled(t *testing.T) { func TestHttpsOnlyProjectDisabled(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, listeners, "") + teardown := RunPagesProcess(t, *pagesBinary, SupportedListeners(), "") defer teardown() rsp, err := GetPageFromListener(t, httpListener, "test2.my-domain.com", "/") @@ -365,7 +365,7 @@ func TestHttpsOnlyProjectDisabled(t *testing.T) { func TestHttpsOnlyDomainDisabled(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, listeners, "") + teardown := RunPagesProcess(t, *pagesBinary, SupportedListeners(), "") defer teardown() rsp, err := GetPageFromListener(t, httpListener, "no.cert.com", "/") @@ -576,13 +576,12 @@ func TestKnownHostInReverseProxySetupReturns200(t *testing.T) { var listeners = []ListenSpec{ proxyListener, - {"proxy", "::1", httpProxyPort}, } teardown := RunPagesProcess(t, *pagesBinary, listeners, "") defer teardown() - for _, spec := range listeners { + for _, spec := range SupportedListeners() { rsp, err := GetProxiedPageFromListener(t, spec, "localhost", "group.gitlab-example.com", "project/") require.NoError(t, err) @@ -643,7 +642,7 @@ func TestDomainResolverError(t *testing.T) { "-gitlab-retrieval-timeout", "200ms", "-gitlab-retrieval-interval", "200ms", "-gitlab-retrieval-retries", "1") } - teardown := RunPagesProcessWithEnvs(t, true, *pagesBinary, listeners, "", []string{}, pagesArgs...) + teardown := RunPagesProcessWithEnvs(t, true, *pagesBinary, SupportedListeners(), "", []string{}, pagesArgs...) defer teardown() response, err := GetPageFromListener(t, httpListener, domainName, "/my/pages/project/") @@ -687,7 +686,7 @@ func doCrossOriginRequest(t *testing.T, spec ListenSpec, method, reqMethod, url func TestQueryStringPersistedInSlashRewrite(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, listeners, "") + teardown := RunPagesProcess(t, *pagesBinary, SupportedListeners(), "") defer teardown() rsp, err := GetRedirectPage(t, httpsListener, "group.gitlab-example.com", "project?q=test") diff --git a/test/acceptance/status_test.go b/test/acceptance/status_test.go index 8e227ed8..d6a0b23c 100644 --- a/test/acceptance/status_test.go +++ b/test/acceptance/status_test.go @@ -10,7 +10,7 @@ import ( func TestStatusPage(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, listeners, "", "-pages-status=/@statuscheck") + teardown := RunPagesProcess(t, *pagesBinary, SupportedListeners(), "", "-pages-status=/@statuscheck") defer teardown() rsp, err := GetPageFromListener(t, httpListener, "group.gitlab-example.com", "@statuscheck") @@ -21,10 +21,10 @@ func TestStatusPage(t *testing.T) { func TestStatusNotYetReady(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcessWithoutWait(t, *pagesBinary, listeners, "", "-pages-status=/@statuscheck", "-pages-root=../../shared/invalid-pages") + teardown := RunPagesProcessWithoutWait(t, *pagesBinary, SupportedListeners(), "", "-pages-status=/@statuscheck", "-pages-root=../../shared/invalid-pages") defer teardown() - waitForRoundtrips(t, listeners, 5*time.Second) + waitForRoundtrips(t, SupportedListeners(), 5*time.Second) rsp, err := GetPageFromListener(t, httpListener, "group.gitlab-example.com", "@statuscheck") require.NoError(t, err) defer rsp.Body.Close() @@ -33,9 +33,9 @@ func TestStatusNotYetReady(t *testing.T) { func TestPageNotAvailableIfNotLoaded(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcessWithoutWait(t, *pagesBinary, listeners, "", "-pages-root=../../shared/invalid-pages") + teardown := RunPagesProcessWithoutWait(t, *pagesBinary, SupportedListeners(), "", "-pages-root=../../shared/invalid-pages") defer teardown() - waitForRoundtrips(t, listeners, 5*time.Second) + waitForRoundtrips(t, SupportedListeners(), 5*time.Second) rsp, err := GetPageFromListener(t, httpListener, "group.gitlab-example.com", "index.html") require.NoError(t, err) diff --git a/test/acceptance/tls_test.go b/test/acceptance/tls_test.go index 3445c6c3..64b6189b 100644 --- a/test/acceptance/tls_test.go +++ b/test/acceptance/tls_test.go @@ -9,7 +9,7 @@ import ( func TestAcceptsSupportedCiphers(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, listeners, "") + teardown := RunPagesProcess(t, *pagesBinary, SupportedListeners(), "") defer teardown() tlsConfig := &tls.Config{ @@ -46,7 +46,7 @@ func tlsConfigWithInsecureCiphersOnly() *tls.Config { func TestRejectsUnsupportedCiphers(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, listeners, "") + teardown := RunPagesProcess(t, *pagesBinary, SupportedListeners(), "") defer teardown() client, cleanup := ClientWithConfig(tlsConfigWithInsecureCiphersOnly()) @@ -64,7 +64,7 @@ func TestRejectsUnsupportedCiphers(t *testing.T) { func TestEnableInsecureCiphers(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, listeners, "", "-insecure-ciphers") + teardown := RunPagesProcess(t, *pagesBinary, SupportedListeners(), "", "-insecure-ciphers") defer teardown() client, cleanup := ClientWithConfig(tlsConfigWithInsecureCiphersOnly()) @@ -103,7 +103,7 @@ func TestTLSVersions(t *testing.T) { args = append(args, "-tls-max-version", tc.tlsMax) } - teardown := RunPagesProcess(t, *pagesBinary, listeners, "", args...) + teardown := RunPagesProcess(t, *pagesBinary, SupportedListeners(), "", args...) defer teardown() tlsConfig := &tls.Config{} diff --git a/test/acceptance/unknown_http_method_test.go b/test/acceptance/unknown_http_method_test.go index f6c5ffee..51c366a2 100644 --- a/test/acceptance/unknown_http_method_test.go +++ b/test/acceptance/unknown_http_method_test.go @@ -9,10 +9,10 @@ import ( func TestUnknownHTTPMethod(t *testing.T) { skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, listeners, "") + teardown := RunPagesProcess(t, *pagesBinary, SupportedListeners(), "") defer teardown() - req, err := http.NewRequest("UNKNOWN", listeners[0].URL(""), nil) + req, err := http.NewRequest("UNKNOWN", httpListener.URL(""), nil) require.NoError(t, err) req.Host = "" diff --git a/test/acceptance/zip_test.go b/test/acceptance/zip_test.go index 91d5df99..fa9c87dd 100644 --- a/test/acceptance/zip_test.go +++ b/test/acceptance/zip_test.go @@ -25,7 +25,7 @@ func TestZipServing(t *testing.T) { gitLabAPISecretKey := CreateGitLabAPISecretKeyFixtureFile(t) pagesArgs := []string{"-gitlab-server", source.URL, "-api-secret-key", gitLabAPISecretKey, "-domain-config-source", "gitlab"} - teardown := RunPagesProcessWithEnvs(t, true, *pagesBinary, listeners, "", []string{}, pagesArgs...) + teardown := RunPagesProcessWithEnvs(t, true, *pagesBinary, SupportedListeners(), "", []string{}, pagesArgs...) defer teardown() tests := map[string]struct { @@ -125,7 +125,7 @@ func TestZipServingFromDisk(t *testing.T) { gitLabAPISecretKey := CreateGitLabAPISecretKeyFixtureFile(t) pagesArgs := []string{"-gitlab-server", source.URL, "-api-secret-key", gitLabAPISecretKey, "-domain-config-source", "gitlab", "-pages-root", wd} - teardown := RunPagesProcessWithEnvs(t, true, *pagesBinary, listeners, "", []string{}, pagesArgs...) + teardown := RunPagesProcessWithEnvs(t, true, *pagesBinary, SupportedListeners(), "", []string{}, pagesArgs...) defer teardown() tests := map[string]struct { @@ -217,7 +217,7 @@ func TestZipServingConfigShortTimeout(t *testing.T) { pagesArgs := []string{"-gitlab-server", source.URL, "-api-secret-key", gitLabAPISecretKey, "-domain-config-source", "gitlab", "-zip-open-timeout=1ns"} // <- test purpose - teardown := RunPagesProcessWithEnvs(t, true, *pagesBinary, listeners, "", []string{}, pagesArgs...) + teardown := RunPagesProcessWithEnvs(t, true, *pagesBinary, SupportedListeners(), "", []string{}, pagesArgs...) defer teardown() _, cleanup := newZipFileServerURL(t, "../../shared/pages/group/zip.gitlab.io/public.zip") |