diff options
author | Jaime Martinez <jmartinez@gitlab.com> | 2021-06-15 10:38:24 +0300 |
---|---|---|
committer | Jaime Martinez <jmartinez@gitlab.com> | 2021-06-23 02:22:26 +0300 |
commit | 4056bf44a8c8274d817e7e8f86452c0189e55592 (patch) | |
tree | b9bce494eef9c0eca8acaafbdb261bab748299c5 /test/acceptance/artifacts_test.go | |
parent | afeb8a4cdc17289b83f5e7d77aebb9a0e62e2f58 (diff) |
Use stub in artifacts_test.go
Diffstat (limited to 'test/acceptance/artifacts_test.go')
-rw-r--r-- | test/acceptance/artifacts_test.go | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/test/acceptance/artifacts_test.go b/test/acceptance/artifacts_test.go index b4dcdce4..476c67c1 100644 --- a/test/acceptance/artifacts_test.go +++ b/test/acceptance/artifacts_test.go @@ -131,16 +131,16 @@ func TestArtifactProxyRequest(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - teardown := RunPagesProcessWithSSLCertFile( - t, - *pagesBinary, - supportedListeners(), - "", - certFile, - "-artifacts-server="+artifactServerURL, - tt.binaryOption, + args := []string{"-artifacts-server=" + artifactServerURL} + if tt.binaryOption != "" { + args = append(args, tt.binaryOption) + } + + RunPagesProcessWithStubGitLabServer(t, + withListeners([]ListenSpec{httpListener}), + withArguments(args), + withEnv([]string{"SSL_CERT_FILE=" + certFile}), ) - defer teardown() resp, err := GetPageFromListener(t, httpListener, tt.host, tt.path) require.NoError(t, err) @@ -170,8 +170,10 @@ func TestPrivateArtifactProxyRequest(t *testing.T) { keyFile, certFile := CreateHTTPSFixtureFiles(t) cert, err := tls.LoadX509KeyPair(certFile, keyFile) require.NoError(t, err) - defer os.Remove(keyFile) - defer os.Remove(certFile) + t.Cleanup(func() { + os.Remove(keyFile) + os.Remove(certFile) + }) testServer.TLS = &tls.Config{Certificates: []tls.Certificate{cert}} testServer.StartTLS() @@ -235,15 +237,13 @@ func TestPrivateArtifactProxyRequest(t *testing.T) { tt.binaryOption) defer cleanup() - teardown := RunPagesProcessWithSSLCertFile( - t, - *pagesBinary, - supportedListeners(), - "", - certFile, - "-config="+configFile, + RunPagesProcessWithStubGitLabServer(t, + withListeners([]ListenSpec{httpsListener}), + withArguments([]string{ + "-config=" + configFile, + }), + withEnv([]string{"SSL_CERT_FILE=" + certFile}), ) - defer teardown() resp, err := GetRedirectPage(t, httpsListener, tt.host, tt.path) require.NoError(t, err) |