From ec465142275e62f2251bc6e27c500714d92e7ec2 Mon Sep 17 00:00:00 2001 From: Jaime Martinez Date: Thu, 15 Jul 2021 13:44:13 +1000 Subject: Remove skipUnlessEnabled(t) from tests --- test/acceptance/acme_test.go | 4 --- test/acceptance/auth_test.go | 7 ----- test/acceptance/config_test.go | 5 ---- test/acceptance/encodings_test.go | 15 ++++------ test/acceptance/helpers_test.go | 7 +---- test/acceptance/metrics_test.go | 2 -- test/acceptance/proxyv2_test.go | 7 ++--- test/acceptance/redirects_test.go | 6 ---- test/acceptance/serving_test.go | 44 ----------------------------- test/acceptance/status_test.go | 3 -- test/acceptance/tls_test.go | 5 ---- test/acceptance/unknown_http_method_test.go | 1 - test/acceptance/zip_test.go | 4 --- 13 files changed, 10 insertions(+), 100 deletions(-) diff --git a/test/acceptance/acme_test.go b/test/acceptance/acme_test.go index c7a33796..af69ff12 100644 --- a/test/acceptance/acme_test.go +++ b/test/acceptance/acme_test.go @@ -15,8 +15,6 @@ const ( ) func TestAcmeChallengesWhenItIsNotConfigured(t *testing.T) { - skipUnlessEnabled(t) - RunPagesProcessWithStubGitLabServer(t, withListeners([]ListenSpec{httpListener}), ) @@ -55,8 +53,6 @@ func TestAcmeChallengesWhenItIsNotConfigured(t *testing.T) { } func TestAcmeChallengesWhenItIsConfigured(t *testing.T) { - skipUnlessEnabled(t) - RunPagesProcessWithStubGitLabServer(t, withListeners([]ListenSpec{httpListener}), withExtraArgument("gitlab-server", "https://gitlab-acme.com"), diff --git a/test/acceptance/auth_test.go b/test/acceptance/auth_test.go index 331bf7d6..96205020 100644 --- a/test/acceptance/auth_test.go +++ b/test/acceptance/auth_test.go @@ -15,7 +15,6 @@ import ( ) func TestWhenAuthIsDisabledPrivateIsNotAccessible(t *testing.T) { - skipUnlessEnabled(t) teardown := RunPagesProcess(t, *pagesBinary, supportedListeners(), "", "") defer teardown() @@ -27,7 +26,6 @@ func TestWhenAuthIsDisabledPrivateIsNotAccessible(t *testing.T) { } func TestWhenAuthIsEnabledPrivateWillRedirectToAuthorize(t *testing.T) { - skipUnlessEnabled(t) teardown := RunPagesProcessWithAuth(t, *pagesBinary, supportedListeners(), "") defer teardown() @@ -59,7 +57,6 @@ func TestWhenAuthIsEnabledPrivateWillRedirectToAuthorize(t *testing.T) { } func TestWhenAuthDeniedWillCauseUnauthorized(t *testing.T) { - skipUnlessEnabled(t) teardown := RunPagesProcessWithAuth(t, *pagesBinary, supportedListeners(), "") defer teardown() @@ -71,7 +68,6 @@ func TestWhenAuthDeniedWillCauseUnauthorized(t *testing.T) { require.Equal(t, http.StatusUnauthorized, rsp.StatusCode) } func TestWhenLoginCallbackWithWrongStateShouldFail(t *testing.T) { - skipUnlessEnabled(t) teardown := RunPagesProcessWithAuth(t, *pagesBinary, supportedListeners(), "") defer teardown() @@ -90,7 +86,6 @@ func TestWhenLoginCallbackWithWrongStateShouldFail(t *testing.T) { } func TestWhenLoginCallbackWithUnencryptedCode(t *testing.T) { - skipUnlessEnabled(t) teardown := RunPagesProcessWithAuth(t, *pagesBinary, supportedListeners(), "") defer teardown() @@ -440,7 +435,6 @@ func TestAccessControlUnderCustomDomainWithHTTPSProxy(t *testing.T) { } func TestAccessControlGroupDomain404RedirectsAuth(t *testing.T) { - skipUnlessEnabled(t) teardown := RunPagesProcessWithAuth(t, *pagesBinary, supportedListeners(), "") defer teardown() @@ -455,7 +449,6 @@ func TestAccessControlGroupDomain404RedirectsAuth(t *testing.T) { require.Equal(t, "/auth", url.Path) } func TestAccessControlProject404DoesNotRedirect(t *testing.T) { - skipUnlessEnabled(t) teardown := RunPagesProcessWithAuth(t, *pagesBinary, supportedListeners(), "") defer teardown() diff --git a/test/acceptance/config_test.go b/test/acceptance/config_test.go index 8e686277..abe0e8ac 100644 --- a/test/acceptance/config_test.go +++ b/test/acceptance/config_test.go @@ -11,8 +11,6 @@ import ( ) func TestEnvironmentVariablesConfig(t *testing.T) { - skipUnlessEnabled(t) - envVarValue := "LISTEN_HTTP=" + net.JoinHostPort(httpListener.Host, httpListener.Port) RunPagesProcessWithStubGitLabServer(t, @@ -30,7 +28,6 @@ func TestEnvironmentVariablesConfig(t *testing.T) { } func TestMixedConfigSources(t *testing.T) { - skipUnlessEnabled(t) envVarValue := "LISTEN_HTTP=" + net.JoinHostPort(httpListener.Host, httpListener.Port) RunPagesProcessWithStubGitLabServer(t, @@ -50,8 +47,6 @@ func TestMixedConfigSources(t *testing.T) { } func TestMultipleListenersFromEnvironmentVariables(t *testing.T) { - skipUnlessEnabled(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")) diff --git a/test/acceptance/encodings_test.go b/test/acceptance/encodings_test.go index e58afd4f..e16306c7 100644 --- a/test/acceptance/encodings_test.go +++ b/test/acceptance/encodings_test.go @@ -9,11 +9,9 @@ import ( ) func TestMIMETypes(t *testing.T) { - skipUnlessEnabled(t) - teardown := RunPagesProcessWithoutWait(t, *pagesBinary, supportedListeners(), "") - defer teardown() - - require.NoError(t, httpListener.WaitUntilRequestSucceeds(nil)) + RunPagesProcessWithStubGitLabServer(t, + withListeners([]ListenSpec{httpListener}), + ) tests := map[string]struct { file string @@ -40,8 +38,6 @@ func TestMIMETypes(t *testing.T) { } func TestCompressedEncoding(t *testing.T) { - skipUnlessEnabled(t) - tests := []struct { name string host string @@ -62,8 +58,9 @@ func TestCompressedEncoding(t *testing.T) { }, } - teardown := RunPagesProcess(t, *pagesBinary, supportedListeners(), "") - defer teardown() + RunPagesProcessWithStubGitLabServer(t, + withListeners([]ListenSpec{httpListener}), + ) for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { diff --git a/test/acceptance/helpers_test.go b/test/acceptance/helpers_test.go index 472f42d1..ebb498d0 100644 --- a/test/acceptance/helpers_test.go +++ b/test/acceptance/helpers_test.go @@ -221,10 +221,6 @@ func RunPagesProcessWithEnvs(t *testing.T, wait bool, pagesBinary string, listen return cleanup } -func RunPagesProcessWithOutput(t *testing.T, pagesBinary string, listeners []ListenSpec, promPort string, extraArgs ...string) (out *LogCaptureBuffer, teardown func()) { - return runPagesProcess(t, true, pagesBinary, listeners, promPort, nil, extraArgs...) -} - func RunPagesProcessWithStubGitLabServer(t *testing.T, opts ...processOption) *LogCaptureBuffer { chdir := false chdirCleanup := testhelpers.ChdirInPath(t, "../../shared/pages", &chdir) @@ -359,13 +355,12 @@ func runPagesProcess(t *testing.T, wait bool, pagesBinary string, listeners []Li func getPagesArgs(t *testing.T, listeners []ListenSpec, promPort string, extraArgs []string) (args, tempfiles []string) { var hasHTTPS bool - args = append(args, "-log-verbose=true") for _, spec := range listeners { args = append(args, "-listen-"+spec.Type, spec.JoinHostPort()) - if spec.Type == request.SchemeHTTPS { + if strings.Contains(spec.Type, request.SchemeHTTPS) { hasHTTPS = true } } diff --git a/test/acceptance/metrics_test.go b/test/acceptance/metrics_test.go index 6ba147aa..e12dfc99 100644 --- a/test/acceptance/metrics_test.go +++ b/test/acceptance/metrics_test.go @@ -9,8 +9,6 @@ import ( ) func TestPrometheusMetricsCanBeScraped(t *testing.T) { - skipUnlessEnabled(t) - _, cleanup := newZipFileServerURL(t, "../../shared/pages/group/zip.gitlab.io/public.zip") defer cleanup() diff --git a/test/acceptance/proxyv2_test.go b/test/acceptance/proxyv2_test.go index 095007ba..ebdca6db 100644 --- a/test/acceptance/proxyv2_test.go +++ b/test/acceptance/proxyv2_test.go @@ -10,10 +10,9 @@ import ( ) func TestProxyv2(t *testing.T) { - skipUnlessEnabled(t) - - logBuf, teardown := RunPagesProcessWithOutput(t, *pagesBinary, supportedListeners(), "") - defer teardown() + logBuf := RunPagesProcessWithStubGitLabServer(t, + withListeners([]ListenSpec{httpsProxyv2Listener}), + ) // the dummy client IP 10.1.1.1 is set by TestProxyv2Client tests := map[string]struct { diff --git a/test/acceptance/redirects_test.go b/test/acceptance/redirects_test.go index ed6ce153..7fd7caab 100644 --- a/test/acceptance/redirects_test.go +++ b/test/acceptance/redirects_test.go @@ -10,8 +10,6 @@ import ( ) func TestDisabledRedirects(t *testing.T) { - skipUnlessEnabled(t) - teardown := RunPagesProcessWithEnvs(t, true, *pagesBinary, supportedListeners(), "", []string{"FF_ENABLE_REDIRECTS=false"}) defer teardown() @@ -31,8 +29,6 @@ func TestDisabledRedirects(t *testing.T) { } func TestRedirectStatusPage(t *testing.T) { - skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, supportedListeners(), "") defer teardown() @@ -48,8 +44,6 @@ func TestRedirectStatusPage(t *testing.T) { } func TestRedirect(t *testing.T) { - skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, supportedListeners(), "") defer teardown() diff --git a/test/acceptance/serving_test.go b/test/acceptance/serving_test.go index 32291e52..049396e6 100644 --- a/test/acceptance/serving_test.go +++ b/test/acceptance/serving_test.go @@ -14,8 +14,6 @@ import ( ) func TestUnknownHostReturnsNotFound(t *testing.T) { - skipUnlessEnabled(t) - RunPagesProcessWithStubGitLabServer(t) for _, spec := range supportedListeners() { @@ -28,8 +26,6 @@ func TestUnknownHostReturnsNotFound(t *testing.T) { } func TestUnknownProjectReturnsNotFound(t *testing.T) { - skipUnlessEnabled(t) - RunPagesProcessWithStubGitLabServer(t) rsp, err := GetPageFromListener(t, httpListener, "group.gitlab-example.com", "/nonexistent/") @@ -39,8 +35,6 @@ func TestUnknownProjectReturnsNotFound(t *testing.T) { } func TestGroupDomainReturns200(t *testing.T) { - skipUnlessEnabled(t) - RunPagesProcessWithStubGitLabServer(t) rsp, err := GetPageFromListener(t, httpListener, "group.gitlab-example.com", "/") @@ -55,8 +49,6 @@ func TestGroupDomainReturns200(t *testing.T) { } func TestKnownHostReturns200(t *testing.T) { - skipUnlessEnabled(t) - RunPagesProcessWithStubGitLabServer(t) tests := []struct { @@ -116,8 +108,6 @@ func TestKnownHostReturns200(t *testing.T) { // TODO: remove along with https://gitlab.com/gitlab-org/gitlab-pages/-/issues/382 func TestNestedSubgroups(t *testing.T) { - skipUnlessEnabled(t) - maxNestedSubgroup := 21 pagesRoot, err := ioutil.TempDir("", "pages-root") @@ -162,8 +152,6 @@ func TestNestedSubgroups(t *testing.T) { } func TestCustom404(t *testing.T) { - skipUnlessEnabled(t) - RunPagesProcessWithStubGitLabServer(t) tests := []struct { @@ -224,8 +212,6 @@ func TestCustom404(t *testing.T) { } func TestCORSWhenDisabled(t *testing.T) { - skipUnlessEnabled(t) - RunPagesProcessWithStubGitLabServer(t, withExtraArgument("disable-cross-origin-requests", "true")) for _, spec := range supportedListeners() { @@ -240,8 +226,6 @@ func TestCORSWhenDisabled(t *testing.T) { } func TestCORSAllowsGET(t *testing.T) { - skipUnlessEnabled(t) - RunPagesProcessWithStubGitLabServer(t) for _, spec := range supportedListeners() { @@ -256,8 +240,6 @@ func TestCORSAllowsGET(t *testing.T) { } func TestCORSForbidsPOST(t *testing.T) { - skipUnlessEnabled(t) - RunPagesProcessWithStubGitLabServer(t) for _, spec := range supportedListeners() { @@ -270,8 +252,6 @@ func TestCORSForbidsPOST(t *testing.T) { } func TestCustomHeaders(t *testing.T) { - skipUnlessEnabled(t) - RunPagesProcessWithStubGitLabServer(t, withExtraArgument("header", "X-Test1:Testing1"), withExtraArgument("header", "X-Test2:Testing2"), @@ -287,8 +267,6 @@ func TestCustomHeaders(t *testing.T) { } func TestKnownHostWithPortReturns200(t *testing.T) { - skipUnlessEnabled(t) - RunPagesProcessWithStubGitLabServer(t) for _, spec := range supportedListeners() { @@ -301,8 +279,6 @@ func TestKnownHostWithPortReturns200(t *testing.T) { } func TestHttpToHttpsRedirectDisabled(t *testing.T) { - skipUnlessEnabled(t) - RunPagesProcessWithStubGitLabServer(t) rsp, err := GetRedirectPage(t, httpListener, "group.gitlab-example.com", "project/") @@ -317,8 +293,6 @@ func TestHttpToHttpsRedirectDisabled(t *testing.T) { } func TestHttpToHttpsRedirectEnabled(t *testing.T) { - skipUnlessEnabled(t) - RunPagesProcessWithStubGitLabServer(t, withExtraArgument("redirect-http", "true")) rsp, err := GetRedirectPage(t, httpListener, "group.gitlab-example.com", "project/") @@ -366,8 +340,6 @@ func TestHTTPSRedirect(t *testing.T) { } func TestHttpsOnlyProjectEnabled(t *testing.T) { - skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, supportedListeners(), "") defer teardown() @@ -378,8 +350,6 @@ func TestHttpsOnlyProjectEnabled(t *testing.T) { } func TestHttpsOnlyProjectDisabled(t *testing.T) { - skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, supportedListeners(), "") defer teardown() @@ -390,8 +360,6 @@ func TestHttpsOnlyProjectDisabled(t *testing.T) { } func TestHttpsOnlyDomainDisabled(t *testing.T) { - skipUnlessEnabled(t) - teardown := RunPagesProcess(t, *pagesBinary, supportedListeners(), "") defer teardown() @@ -402,8 +370,6 @@ func TestHttpsOnlyDomainDisabled(t *testing.T) { } func TestDomainsSource(t *testing.T) { - skipUnlessEnabled(t) - type args struct { configSource string domain string @@ -583,8 +549,6 @@ func TestGitLabSourceBecomesUnauthorized(t *testing.T) { } func TestKnownHostInReverseProxySetupReturns200(t *testing.T) { - skipUnlessEnabled(t) - RunPagesProcessWithStubGitLabServer(t) rsp, err := GetProxiedPageFromListener(t, proxyListener, "localhost", "group.gitlab-example.com", "project/") @@ -595,8 +559,6 @@ func TestKnownHostInReverseProxySetupReturns200(t *testing.T) { } func TestDomainResolverError(t *testing.T) { - skipUnlessEnabled(t) - domainName := "new-source-test.gitlab.io" opts := &stubOpts{ apiCalled: false, @@ -689,8 +651,6 @@ func doCrossOriginRequest(t *testing.T, spec ListenSpec, method, reqMethod, url } func TestQueryStringPersistedInSlashRewrite(t *testing.T) { - skipUnlessEnabled(t) - RunPagesProcessWithStubGitLabServer(t) rsp, err := GetRedirectPage(t, httpsListener, "group.gitlab-example.com", "project?q=test") @@ -708,8 +668,6 @@ func TestQueryStringPersistedInSlashRewrite(t *testing.T) { } func TestServerRepliesWithHeaders(t *testing.T) { - skipUnlessEnabled(t) - tests := map[string]struct { flags []string expectedHeaders map[string][]string @@ -774,8 +732,6 @@ func TestServerRepliesWithHeaders(t *testing.T) { } func TestDiskDisabledFailsToServeFileAndLocalContent(t *testing.T) { - skipUnlessEnabled(t) - logBuf := RunPagesProcessWithStubGitLabServer(t, withExtraArgument("enable-disk", "false"), ) diff --git a/test/acceptance/status_test.go b/test/acceptance/status_test.go index 84bdf476..13aa9534 100644 --- a/test/acceptance/status_test.go +++ b/test/acceptance/status_test.go @@ -9,7 +9,6 @@ import ( ) func TestStatusPage(t *testing.T) { - skipUnlessEnabled(t) teardown := RunPagesProcess(t, *pagesBinary, supportedListeners(), "", "-pages-status=/@statuscheck") defer teardown() @@ -20,7 +19,6 @@ func TestStatusPage(t *testing.T) { } func TestStatusNotYetReady(t *testing.T) { - skipUnlessEnabled(t) teardown := RunPagesProcessWithoutWait(t, *pagesBinary, supportedListeners(), "", "-pages-status=/@statuscheck", "-pages-root=../../shared/invalid-pages") defer teardown() @@ -32,7 +30,6 @@ func TestStatusNotYetReady(t *testing.T) { } func TestPageNotAvailableIfNotLoaded(t *testing.T) { - skipUnlessEnabled(t) teardown := RunPagesProcessWithoutWait(t, *pagesBinary, supportedListeners(), "", "-pages-root=../../shared/invalid-pages") defer teardown() waitForRoundtrips(t, supportedListeners(), 5*time.Second) diff --git a/test/acceptance/tls_test.go b/test/acceptance/tls_test.go index 8e887a83..a332e407 100644 --- a/test/acceptance/tls_test.go +++ b/test/acceptance/tls_test.go @@ -8,7 +8,6 @@ import ( ) func TestAcceptsSupportedCiphers(t *testing.T) { - skipUnlessEnabled(t) teardown := RunPagesProcess(t, *pagesBinary, supportedListeners(), "") defer teardown() @@ -45,7 +44,6 @@ func tlsConfigWithInsecureCiphersOnly() *tls.Config { } func TestRejectsUnsupportedCiphers(t *testing.T) { - skipUnlessEnabled(t) teardown := RunPagesProcess(t, *pagesBinary, supportedListeners(), "") defer teardown() @@ -63,7 +61,6 @@ func TestRejectsUnsupportedCiphers(t *testing.T) { } func TestEnableInsecureCiphers(t *testing.T) { - skipUnlessEnabled(t) teardown := RunPagesProcess(t, *pagesBinary, supportedListeners(), "", "-insecure-ciphers") defer teardown() @@ -80,8 +77,6 @@ func TestEnableInsecureCiphers(t *testing.T) { } func TestTLSVersions(t *testing.T) { - skipUnlessEnabled(t) - tests := map[string]struct { tlsMin string tlsMax string diff --git a/test/acceptance/unknown_http_method_test.go b/test/acceptance/unknown_http_method_test.go index 3aabf800..ffa07153 100644 --- a/test/acceptance/unknown_http_method_test.go +++ b/test/acceptance/unknown_http_method_test.go @@ -8,7 +8,6 @@ import ( ) func TestUnknownHTTPMethod(t *testing.T) { - skipUnlessEnabled(t) teardown := RunPagesProcess(t, *pagesBinary, supportedListeners(), "") defer teardown() diff --git a/test/acceptance/zip_test.go b/test/acceptance/zip_test.go index 212435e8..09e69051 100644 --- a/test/acceptance/zip_test.go +++ b/test/acceptance/zip_test.go @@ -14,8 +14,6 @@ import ( ) func TestZipServing(t *testing.T) { - skipUnlessEnabled(t) - _, cleanup := newZipFileServerURL(t, "../../shared/pages/group/zip.gitlab.io/public.zip") defer cleanup() @@ -207,8 +205,6 @@ func TestZipServingFromDisk(t *testing.T) { } func TestZipServingConfigShortTimeout(t *testing.T) { - skipUnlessEnabled(t) - source := NewGitlabDomainsSourceStub(t, &stubOpts{}) defer source.Close() -- cgit v1.2.3