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:
authorVladimir Shushlin <vshushlin@gitlab.com>2019-06-03 14:22:03 +0300
committerNick Thomas <nick@gitlab.com>2019-06-03 14:22:03 +0300
commit9df35356572e09dc2c0907113bf64479204e46a9 (patch)
tree70297534cace3ad4c6015df32757690cc9244992 /config_test.go
parent80fa0bb4e200a6b3b9194766dd209de28d1cf08a (diff)
Redirect unknown ACME challenges to the GitLab instance
Diffstat (limited to 'config_test.go')
-rw-r--r--config_test.go54
1 files changed, 54 insertions, 0 deletions
diff --git a/config_test.go b/config_test.go
new file mode 100644
index 00000000..3ec51c56
--- /dev/null
+++ b/config_test.go
@@ -0,0 +1,54 @@
+package main
+
+import (
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+)
+
+func TestGitLabServerFromFlags(t *testing.T) {
+ tests := []struct {
+ name string
+ gitLabServer string
+ gitLabAuthServer string
+ artifactsServer string
+ expected string
+ }{
+ {
+ name: "When gitLabServer is set",
+ gitLabServer: "gitlabserver.com",
+ gitLabAuthServer: "authserver.com",
+ artifactsServer: "https://artifactsserver.com",
+ expected: "gitlabserver.com",
+ },
+ {
+ name: "When auth server is set",
+ gitLabServer: "",
+ gitLabAuthServer: "authserver.com",
+ artifactsServer: "https://artifactsserver.com",
+ expected: "authserver.com",
+ },
+ {
+ name: "When only artifacts server is set",
+ gitLabServer: "",
+ gitLabAuthServer: "",
+ artifactsServer: "https://artifactsserver.com",
+ expected: "artifactsserver.com",
+ },
+ {
+ name: "When only artifacts server includes path",
+ gitLabServer: "",
+ gitLabAuthServer: "",
+ artifactsServer: "https://artifactsserver.com:8080/api/path",
+ expected: "artifactsserver.com",
+ }}
+
+ for _, test := range tests {
+ t.Run(test.name, func(t *testing.T) {
+ gitLabServer = &test.gitLabServer
+ gitLabAuthServer = &test.gitLabAuthServer
+ artifactsServer = &test.artifactsServer
+ assert.Equal(t, test.expected, gitlabServerFromFlags())
+ })
+ }
+}