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:
authorJaime Martinez <jmartinez@gitlab.com>2020-06-29 10:09:59 +0300
committerJaime Martinez <jmartinez@gitlab.com>2020-06-30 03:52:45 +0300
commiteb8da5918ad17c938ee6d9e2d835eac8238caa01 (patch)
treebcaa4374c6bb16183ef8a80dd4efbe5aca13ae93
parent39b418a5b54b717ff49573d46222e4713d2306bb (diff)
Add acceptance test for zip source
-rw-r--r--acceptance_test.go25
-rw-r--r--internal/serving/lookup_path.go1
-rw-r--r--shared/lookups/zip.gitlab.io.json16
-rw-r--r--shared/pages/group/zip.gitlab.io/public.zipbin341 -> 520 bytes
4 files changed, 41 insertions, 1 deletions
diff --git a/acceptance_test.go b/acceptance_test.go
index 9497511a..e612b678 100644
--- a/acceptance_test.go
+++ b/acceptance_test.go
@@ -1538,6 +1538,7 @@ func TestGitlabDomainsSource(t *testing.T) {
domains:
enabled:
- new-source-test.gitlab.io
+ - zip.gitlab.io
broken: pages-broken-poc.gitlab.io
`
gitlabSourceConfigFile, cleanupGitlabSourceConfigFile := CreateGitlabSourceConfigFixtureFile(t, gitlabSourceConfig)
@@ -1579,4 +1580,28 @@ domains:
require.Equal(t, http.StatusBadGateway, response.StatusCode)
})
+
+ t.Run("zip source", func(t *testing.T) {
+ response, err := GetPageFromListener(t, httpListener, "zip.gitlab.io", "/my/pages/zip/project/")
+ require.NoError(t, err)
+
+ defer response.Body.Close()
+ body, err := ioutil.ReadAll(response.Body)
+ require.NoError(t, err)
+
+ require.Equal(t, http.StatusOK, response.StatusCode)
+ require.Equal(t, "zip/index.html\n", string(body))
+ })
+
+ t.Run("zip source custom not found", func(t *testing.T) {
+ response, err := GetPageFromListener(t, httpListener, "zip.gitlab.io", "/my/pages/zip/project/unknown")
+ require.NoError(t, err)
+
+ defer response.Body.Close()
+ body, err := ioutil.ReadAll(response.Body)
+ require.NoError(t, err)
+
+ require.Equal(t, http.StatusNotFound, response.StatusCode)
+ require.Equal(t, "zip custom not found\n", string(body))
+ })
}
diff --git a/internal/serving/lookup_path.go b/internal/serving/lookup_path.go
index e162d7ac..4360358b 100644
--- a/internal/serving/lookup_path.go
+++ b/internal/serving/lookup_path.go
@@ -8,5 +8,4 @@ type LookupPath struct {
IsHTTPSOnly bool
HasAccessControl bool
ProjectID uint64
- Domain string
}
diff --git a/shared/lookups/zip.gitlab.io.json b/shared/lookups/zip.gitlab.io.json
new file mode 100644
index 00000000..cf54d49e
--- /dev/null
+++ b/shared/lookups/zip.gitlab.io.json
@@ -0,0 +1,16 @@
+{
+ "certificate": "",
+ "key": "",
+ "lookup_paths": [
+ {
+ "access_control": false,
+ "https_only": false,
+ "prefix": "/my/pages/zip/project/",
+ "project_id": 123,
+ "source": {
+ "path": "group/zip.gitlab.io/public.zip",
+ "type": "zip"
+ }
+ }
+ ]
+}
diff --git a/shared/pages/group/zip.gitlab.io/public.zip b/shared/pages/group/zip.gitlab.io/public.zip
index 55632d9e..0d43cfad 100644
--- a/shared/pages/group/zip.gitlab.io/public.zip
+++ b/shared/pages/group/zip.gitlab.io/public.zip
Binary files differ