Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2018-03-22 21:25:24 +0300
committerNick Thomas <nick@gitlab.com>2018-03-23 20:33:57 +0300
commit8cfda639dbf6735896ca5849ee5671cea71d2986 (patch)
tree3d7e6de87b64f1ede66815ef77ed365722a31297 /helpers_test.go
parent6a521a1140afe9eff59dd2d6fd8b7b25bfd0994b (diff)
Run the acceptance tests both daemonized and not
Diffstat (limited to 'helpers_test.go')
-rw-r--r--helpers_test.go14
1 files changed, 10 insertions, 4 deletions
diff --git a/helpers_test.go b/helpers_test.go
index a8d804c2..97374d19 100644
--- a/helpers_test.go
+++ b/helpers_test.go
@@ -9,6 +9,7 @@ import (
"net/http"
"os"
"os/exec"
+ "strconv"
"strings"
"testing"
"time"
@@ -229,10 +230,15 @@ func getPagesArgs(t *testing.T, listeners []ListenSpec, promPort string, extraAr
}
// At least one of `-daemon-uid` and `-daemon-gid` must be non-zero
- if os.Geteuid() == 0 {
- t.Log("Running pages as a daemon")
- args = append(args, "-daemon-uid", "0")
- args = append(args, "-daemon-gid", "65534") // Root user can switch to "nobody"
+ if daemon, _ := strconv.ParseBool(os.Getenv("TEST_DAEMONIZE")); daemon {
+ if os.Geteuid() == 0 {
+ t.Log("Running pages as a daemon")
+ args = append(args, "-daemon-uid", "0")
+ args = append(args, "-daemon-gid", "65534") // Root user can switch to "nobody"
+ } else {
+ t.Log("Privilege-dropping requested but not running as root!")
+ t.FailNow()
+ }
}
args = append(args, extraArgs...)