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:
Diffstat (limited to 'test/acceptance/acceptance_test.go')
-rw-r--r--test/acceptance/acceptance_test.go71
1 files changed, 71 insertions, 0 deletions
diff --git a/test/acceptance/acceptance_test.go b/test/acceptance/acceptance_test.go
new file mode 100644
index 00000000..e155ce8b
--- /dev/null
+++ b/test/acceptance/acceptance_test.go
@@ -0,0 +1,71 @@
+package acceptance_test
+
+import (
+ "flag"
+ "fmt"
+ "log"
+ "os"
+ "testing"
+
+ "gitlab.com/gitlab-org/gitlab-pages/internal/fixture"
+)
+
+const (
+ objectStorageMockServer = "127.0.0.1:37003"
+)
+
+var (
+ pagesBinary = flag.String("gitlab-pages-binary", "../../gitlab-pages", "Path to the gitlab-pages binary")
+
+ // 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
+ // hardcoded values below.
+ listeners = []ListenSpec{
+ {"http", "127.0.0.1", "37000"},
+ {"http", "::1", "37000"},
+ {"https", "127.0.0.1", "37001"},
+ {"https", "::1", "37001"},
+ {"proxy", "127.0.0.1", "37002"},
+ {"proxy", "::1", "37002"},
+ }
+
+ httpListener = listeners[0]
+ httpsListener = listeners[2]
+ proxyListener = listeners[4]
+)
+
+func TestMain(m *testing.M) {
+ flag.Parse()
+
+ if testing.Short() {
+ log.Println("Acceptance tests disabled")
+ os.Exit(0)
+ }
+
+ if _, err := os.Stat(*pagesBinary); os.IsNotExist(err) {
+ log.Fatalf("Couldn't find gitlab-pages binary at %s\n", *pagesBinary)
+ }
+
+ if ok := TestCertPool.AppendCertsFromPEM([]byte(fixture.Certificate)); !ok {
+ fmt.Println("Failed to load cert!")
+ }
+
+ os.Exit(m.Run())
+}
+
+func skipUnlessEnabled(t *testing.T, conditions ...string) {
+ t.Helper()
+
+ for _, condition := range conditions {
+ switch condition {
+ case "not-inplace-chroot":
+ if os.Getenv("TEST_DAEMONIZE") == "inplace" {
+ t.Log("Not supported with -daemon-inplace-chroot")
+ t.SkipNow()
+ }
+ default:
+ t.Error("Unknown condition:", condition)
+ t.FailNow()
+ }
+ }
+}