diff options
Diffstat (limited to 'test/acceptance/serving_test.go')
-rw-r--r-- | test/acceptance/serving_test.go | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/test/acceptance/serving_test.go b/test/acceptance/serving_test.go index 6afa9560..e3f5cb3c 100644 --- a/test/acceptance/serving_test.go +++ b/test/acceptance/serving_test.go @@ -381,7 +381,7 @@ func TestDomainsSource(t *testing.T) { configSource string domain string urlSuffix string - readyCount int + stubOpts stubOpts } type want struct { statusCode int @@ -459,7 +459,9 @@ func TestDomainsSource(t *testing.T) { configSource: "auto", domain: "test.domain.com", urlSuffix: "/", - readyCount: 100, // big number to ensure the API is in bad state for a while + stubOpts: stubOpts{ + statusReadyCount: 100, // big number to ensure the API is in bad state for a while + }, }, want: want{ statusCode: http.StatusOK, @@ -473,7 +475,6 @@ func TestDomainsSource(t *testing.T) { configSource: "auto", domain: "new-source-test.gitlab.io", urlSuffix: "/my/pages/project/", - readyCount: 0, }, want: want{ statusCode: http.StatusOK, @@ -481,14 +482,29 @@ func TestDomainsSource(t *testing.T) { apiCalled: true, }, }, + { + name: "auto_source_gitlab_is_unauthorized_fallback_to_disk", + args: args{ + configSource: "auto", + domain: "test.domain.com", + urlSuffix: "/", + stubOpts: stubOpts{ + apiCalled: false, + // edge case https://gitlab.com/gitlab-org/gitlab-pages/-/issues/535 + pagesStatusResponse: http.StatusUnauthorized, + }, + }, + want: want{ + statusCode: http.StatusOK, + content: "main-dir\n", + apiCalled: true, + }, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - opts := &stubOpts{ - apiCalled: false, - statusReadyCount: tt.args.readyCount, - } + opts := &tt.args.stubOpts source := NewGitlabDomainsSourceStub(t, opts) defer source.Close() |