diff options
author | Alessio Caiazza <acaiazza@gitlab.com> | 2018-03-21 20:29:55 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2018-03-21 20:29:55 +0300 |
commit | 51f0df18e3d8dd5f1e0faeea3b2a41e6ff73f551 (patch) | |
tree | 8c222620310e6bb5a967f099314e40428e920c73 /helpers_test.go | |
parent | fe1561978ed164220e471129c9b2fa6b89d07992 (diff) |
Add /etc/resolv.conf and /etc/ssl/certs to pages chroot
Diffstat (limited to 'helpers_test.go')
-rw-r--r-- | helpers_test.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/helpers_test.go b/helpers_test.go index 44fc3797..a8d804c2 100644 --- a/helpers_test.go +++ b/helpers_test.go @@ -161,20 +161,24 @@ func (l ListenSpec) JoinHostPort() string { // // If run as root via sudo, the gitlab-pages process will drop privileges func RunPagesProcess(t *testing.T, pagesPath string, listeners []ListenSpec, promPort string, extraArgs ...string) (teardown func()) { - return runPagesProcess(t, true, pagesPath, listeners, promPort, extraArgs...) + return runPagesProcess(t, true, pagesPath, listeners, promPort, nil, extraArgs...) } func RunPagesProcessWithoutWait(t *testing.T, pagesPath string, listeners []ListenSpec, promPort string, extraArgs ...string) (teardown func()) { - return runPagesProcess(t, false, pagesPath, listeners, promPort, extraArgs...) + return runPagesProcess(t, false, pagesPath, listeners, promPort, nil, extraArgs...) } -func runPagesProcess(t *testing.T, wait bool, pagesPath string, listeners []ListenSpec, promPort string, extraArgs ...string) (teardown func()) { +func RunPagesProcessWithSSLCertFile(t *testing.T, pagesPath string, listeners []ListenSpec, promPort string, sslCertFile string, extraArgs ...string) (teardown func()) { + return runPagesProcess(t, true, pagesPath, listeners, promPort, []string{"SSL_CERT_FILE=" + sslCertFile}, extraArgs...) +} + +func runPagesProcess(t *testing.T, wait bool, pagesPath string, listeners []ListenSpec, promPort string, extraEnv []string, extraArgs ...string) (teardown func()) { _, err := os.Stat(pagesPath) require.NoError(t, err) args, tempfiles := getPagesArgs(t, listeners, promPort, extraArgs) cmd := exec.Command(pagesPath, args...) - cmd.Env = os.Environ() + cmd.Env = append(os.Environ(), extraEnv...) cmd.Stdout = &tWriter{t} cmd.Stderr = &tWriter{t} require.NoError(t, cmd.Start()) |