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:
authorAlessio Caiazza <acaiazza@gitlab.com>2018-10-11 10:32:02 +0300
committerAlessio Caiazza <acaiazza@gitlab.com>2018-10-12 10:43:33 +0300
commitcc29737d96d41a7ce5e54f67bebe39ae507bb99e (patch)
treecf0fa67d3913482cbb00c8b1a98d3bcd9a5047ce
parentd33590ec85ed14ba7aaa824890ef562ff9967d7d (diff)
Add acceptance tests for URLs with capital letters
-rw-r--r--acceptance_test.go43
-rw-r--r--internal/domain/map_test.go1
-rw-r--r--shared/pages/CapitalGroup/CapitalProject/public/index.html1
-rw-r--r--shared/pages/CapitalGroup/project/public/index.html1
-rw-r--r--shared/pages/group/CapitalProject/public/index.html1
5 files changed, 41 insertions, 6 deletions
diff --git a/acceptance_test.go b/acceptance_test.go
index 17eb7cb4..4100fde1 100644
--- a/acceptance_test.go
+++ b/acceptance_test.go
@@ -103,12 +103,43 @@ func TestKnownHostReturns200(t *testing.T) {
teardown := RunPagesProcess(t, *pagesBinary, listeners, "")
defer teardown()
- for _, spec := range listeners {
- rsp, err := GetPageFromListener(t, spec, "group.gitlab-example.com", "project/")
+ tests := []struct {
+ name string
+ host string
+ path string
+ }{
+ {
+ name: "lower case",
+ host: "group.gitlab-example.com",
+ path: "project/",
+ },
+ {
+ name: "capital project",
+ host: "group.gitlab-example.com",
+ path: "CapitalProject/",
+ },
+ {
+ name: "capital group",
+ host: "CapitalGroup.gitlab-example.com",
+ path: "project/",
+ },
+ {
+ name: "capital group and project",
+ host: "CapitalGroup.gitlab-example.com",
+ path: "CapitalProject/",
+ },
+ }
- require.NoError(t, err)
- rsp.Body.Close()
- assert.Equal(t, http.StatusOK, rsp.StatusCode)
+ for _, test := range tests {
+ t.Run(test.name, func(t *testing.T) {
+ for _, spec := range listeners {
+ rsp, err := GetPageFromListener(t, spec, test.host, test.path)
+
+ require.NoError(t, err)
+ rsp.Body.Close()
+ assert.Equal(t, http.StatusOK, rsp.StatusCode)
+ }
+ })
}
}
@@ -298,7 +329,7 @@ func TestPrometheusMetricsCanBeScraped(t *testing.T) {
body, _ := ioutil.ReadAll(resp.Body)
assert.Contains(t, string(body), "gitlab_pages_http_sessions_active 0")
- assert.Contains(t, string(body), "gitlab_pages_domains_served_total 13")
+ assert.Contains(t, string(body), "gitlab_pages_domains_served_total 14")
}
}
diff --git a/internal/domain/map_test.go b/internal/domain/map_test.go
index 31ebc016..a2b2b575 100644
--- a/internal/domain/map_test.go
+++ b/internal/domain/map_test.go
@@ -53,6 +53,7 @@ func TestReadProjects(t *testing.T) {
"no.cert.com",
"private.domain.com",
"group.auth.test.io",
+ "capitalgroup.test.io",
}
for _, expected := range domains {
diff --git a/shared/pages/CapitalGroup/CapitalProject/public/index.html b/shared/pages/CapitalGroup/CapitalProject/public/index.html
new file mode 100644
index 00000000..e977a6bf
--- /dev/null
+++ b/shared/pages/CapitalGroup/CapitalProject/public/index.html
@@ -0,0 +1 @@
+Capital Group & Project
diff --git a/shared/pages/CapitalGroup/project/public/index.html b/shared/pages/CapitalGroup/project/public/index.html
new file mode 100644
index 00000000..6f2b9967
--- /dev/null
+++ b/shared/pages/CapitalGroup/project/public/index.html
@@ -0,0 +1 @@
+Capital Group
diff --git a/shared/pages/group/CapitalProject/public/index.html b/shared/pages/group/CapitalProject/public/index.html
new file mode 100644
index 00000000..e1b52676
--- /dev/null
+++ b/shared/pages/group/CapitalProject/public/index.html
@@ -0,0 +1 @@
+Capital Project