diff options
author | Jaime Martinez <jmartinez@gitlab.com> | 2020-04-27 09:25:37 +0300 |
---|---|---|
committer | Vladimir Shushlin <v.shushlin@gmail.com> | 2020-05-08 15:06:07 +0300 |
commit | 3d60bf10dafec57eb89f8194d18402a69f29c701 (patch) | |
tree | ae60f23fe882d47d835ed0b9a39c12b45c22a272 /acceptance_test.go | |
parent | c50b59d216af4d5929587e8ef5b460acbcd3cdd4 (diff) |
Write config file for some acceptance tests
Use filename from closure
Diffstat (limited to 'acceptance_test.go')
-rw-r--r-- | acceptance_test.go | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/acceptance_test.go b/acceptance_test.go index 29a6928d..4a1b3028 100644 --- a/acceptance_test.go +++ b/acceptance_test.go @@ -4,7 +4,6 @@ import ( "crypto/tls" "fmt" "io/ioutil" - "log" "mime" "net" "net/http" @@ -21,7 +20,6 @@ import ( ) var pagesBinary = flag.String("gitlab-pages-binary", "./gitlab-pages", "Path to the gitlab-pages binary") -var configFile string // TODO: Use TCP port 0 everywhere to avoid conflicts. The binary could output // the actual port (and type of listener) for us to read in place of the @@ -68,17 +66,6 @@ func skipUnlessEnabled(t *testing.T, conditions ...string) { } } -func TestMain(m *testing.M) { - var err error - configFile, err = accessControlConfig("clientID", "clientSecret", "authSecret") - if err != nil { - log.Fatal(err) - } - defer os.Remove(configFile) - - os.Exit(m.Run()) -} - func TestUnknownHostReturnsNotFound(t *testing.T) { skipUnlessEnabled(t) teardown := RunPagesProcess(t, *pagesBinary, listeners, "") @@ -663,7 +650,7 @@ func TestPrivateArtifactProxyRequest(t *testing.T) { host: "group.gitlab-example.com", path: "/-/private/-/jobs/1/artifacts/delayed_200.html", status: http.StatusBadGateway, - binaryOption: "-artifacts-server-timeout=1", + binaryOption: "artifacts-server-timeout=1", }, { name: "Proxying 404 from server", @@ -689,6 +676,13 @@ func TestPrivateArtifactProxyRequest(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + configFile, cleanup := defaultConfigFileWith(t, + "artifacts-server="+artifactServerURL, + "auth-server="+testServer.URL, + "auth-redirect-uri=https://projects.gitlab-example.com/auth", + tt.binaryOption) + defer cleanup() + teardown := RunPagesProcessWithSSLCertFile( t, *pagesBinary, @@ -696,10 +690,6 @@ func TestPrivateArtifactProxyRequest(t *testing.T) { "", certFile, "-config="+configFile, - "-artifacts-server="+artifactServerURL, - "-auth-server="+testServer.URL, - "-auth-redirect-uri=https://projects.gitlab-example.com/auth", - tt.binaryOption, ) defer teardown() |