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>2021-04-13 09:05:18 +0300
committerJaime Martinez <jmartinez@gitlab.com>2021-04-20 04:45:41 +0300
commit149cfe6fc037eb402002478cc6074280c62766ca (patch)
treedad5988482c7e8550ffef21c7b7b3cf136fe96b2
parent452cdc9e9d193649c2b2b3c2cd32834e86b5a687 (diff)
Add enable-disk to acceptance tests543-pages-root-false
-rw-r--r--internal/config/flags.go4
-rw-r--r--test/acceptance/serving_test.go50
2 files changed, 42 insertions, 12 deletions
diff --git a/internal/config/flags.go b/internal/config/flags.go
index 642d75ff..47c6d220 100644
--- a/internal/config/flags.go
+++ b/internal/config/flags.go
@@ -13,8 +13,8 @@ var (
pagesRootKey = flag.String("root-key", "", "The default path to file certificate to serve static pages")
redirectHTTP = flag.Bool("redirect-http", false, "Redirect pages from HTTP to HTTPS")
useHTTP2 = flag.Bool("use-http2", true, "Enable HTTP2 support")
- pagesRoot = flag.String("pages-root", "shared/pages", "The directory where pages are stored.")
- enableDisk = flag.Bool("enable-disk", true, "Set to \"false\" to disable disk access.")
+ pagesRoot = flag.String("pages-root", "shared/pages", "The directory where pages are stored")
+ enableDisk = flag.Bool("enable-disk", true, "Set to \"false\" to disable disk access")
pagesDomain = flag.String("pages-domain", "gitlab-example.com", "The domain to serve static pages")
artifactsServer = flag.String("artifacts-server", "", "API URL to proxy artifact requests to, e.g.: 'https://gitlab.com/api/v4'")
artifactsServerTimeout = flag.Int("artifacts-server-timeout", 10, "Timeout (in seconds) for a proxied request to the artifacts server")
diff --git a/test/acceptance/serving_test.go b/test/acceptance/serving_test.go
index da8c87e0..776356bf 100644
--- a/test/acceptance/serving_test.go
+++ b/test/acceptance/serving_test.go
@@ -379,8 +379,8 @@ func TestDomainsSource(t *testing.T) {
type args struct {
configSource string
- pagesRoot string
useLegacyStorage bool
+ enableDisk bool
domain string
urlSuffix string
readyCount int
@@ -422,6 +422,7 @@ func TestDomainsSource(t *testing.T) {
{
name: "disk_source_domain_exists",
args: args{
+ enableDisk: true,
configSource: "disk",
// test.domain.com sourced from disk configuration
domain: "test.domain.com",
@@ -436,6 +437,7 @@ func TestDomainsSource(t *testing.T) {
{
name: "disk_source_domain_does_not_exist",
args: args{
+ enableDisk: true,
configSource: "disk",
domain: "non-existent-domain.gitlab.io",
},
@@ -447,6 +449,7 @@ func TestDomainsSource(t *testing.T) {
{
name: "disk_source_domain_should_not_exist_under_hashed_dir",
args: args{
+ enableDisk: true,
configSource: "disk",
domain: "hashed.com",
},
@@ -458,6 +461,7 @@ func TestDomainsSource(t *testing.T) {
{
name: "auto_source_gitlab_is_not_ready",
args: args{
+ enableDisk: true,
configSource: "auto",
domain: "test.domain.com",
urlSuffix: "/",
@@ -472,6 +476,7 @@ func TestDomainsSource(t *testing.T) {
{
name: "auto_source_gitlab_is_ready",
args: args{
+ enableDisk: true,
configSource: "auto",
domain: "new-source-test.gitlab.io",
urlSuffix: "/my/pages/project/",
@@ -487,6 +492,7 @@ func TestDomainsSource(t *testing.T) {
name: "use_legacy_storage_overrides_domain_source",
args: args{
useLegacyStorage: true,
+ enableDisk: true,
domain: "test.domain.com",
urlSuffix: "/",
},
@@ -497,11 +503,13 @@ func TestDomainsSource(t *testing.T) {
},
},
{
- name: "pages",
+ name: "enable_disk_with_auto_source",
args: args{
- useLegacyStorage: true,
- domain: "test.domain.com",
- urlSuffix: "/",
+ enableDisk: true,
+ configSource: "auto",
+ domain: "test.domain.com",
+ urlSuffix: "/",
+ readyCount: 100, // big number to ensure the API is in bad state for a while
},
want: want{
statusCode: http.StatusOK,
@@ -509,6 +517,32 @@ func TestDomainsSource(t *testing.T) {
apiCalled: false,
},
},
+ {
+ name: "enable_disk_with_gitlab_source_disk_ignored",
+ args: args{
+ enableDisk: true,
+ configSource: "gitlab",
+ domain: "test.domain.com",
+ urlSuffix: "/",
+ },
+ want: want{
+ statusCode: http.StatusNotFound,
+ apiCalled: true,
+ },
+ },
+ {
+ name: "disable_disk_auto_source",
+ args: args{
+ enableDisk: false,
+ configSource: "auto",
+ domain: "test.domain.com",
+ urlSuffix: "/",
+ },
+ want: want{
+ statusCode: http.StatusNotFound,
+ apiCalled: true,
+ },
+ },
}
for _, tt := range tests {
@@ -523,14 +557,10 @@ func TestDomainsSource(t *testing.T) {
gitLabAPISecretKey := CreateGitLabAPISecretKeyFixtureFile(t)
- if tt.args.pagesRoot == "" {
- tt.args.pagesRoot = "../../shared/pages"
- }
-
pagesArgs := []string{"-gitlab-server", source.URL, "-api-secret-key", gitLabAPISecretKey, "-domain-config-source", tt.args.configSource,
// TODO: remove in https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/6009
fmt.Sprintf("-use-legacy-storage=%t", tt.args.useLegacyStorage),
- "-pages-root", tt.args.pagesRoot,
+ fmt.Sprintf("-enable-disk=%t", tt.args.enableDisk),
}
teardown := RunPagesProcessWithEnvs(t, true, *pagesBinary, []ListenSpec{httpListener}, "", []string{}, pagesArgs...)
defer teardown()