diff options
author | feistel <6742251-feistel@users.noreply.gitlab.com> | 2021-06-15 14:16:04 +0300 |
---|---|---|
committer | feistel <6742251-feistel@users.noreply.gitlab.com> | 2021-08-17 14:47:01 +0300 |
commit | d922473a13483bee223217c08a3b4914a910b636 (patch) | |
tree | 70a739b2ffd721f22b01a5c75f168b0dacb892fc /test | |
parent | d79892fe182e3c28cd055bd34669d82c1ab5294b (diff) |
refactor: remove GitLab API internal polling
Diffstat (limited to 'test')
-rw-r--r-- | test/acceptance/helpers_test.go | 18 | ||||
-rw-r--r-- | test/acceptance/serving_test.go | 32 |
2 files changed, 1 insertions, 49 deletions
diff --git a/test/acceptance/helpers_test.go b/test/acceptance/helpers_test.go index c5fd8319..b75add4b 100644 --- a/test/acceptance/helpers_test.go +++ b/test/acceptance/helpers_test.go @@ -545,10 +545,8 @@ func waitForRoundtrips(t *testing.T, listeners []ListenSpec, timeout time.Durati type stubOpts struct { m sync.RWMutex apiCalled bool - statusReadyCount int authHandler http.HandlerFunc userHandler http.HandlerFunc - statusHandler http.HandlerFunc pagesHandler http.HandlerFunc pagesStatusResponse int pagesRoot string @@ -558,23 +556,7 @@ func NewGitlabDomainsSourceStub(t *testing.T, opts *stubOpts) *httptest.Server { t.Helper() require.NotNil(t, opts) - currentStatusCount := 0 - router := mux.NewRouter() - statusHandler := func(w http.ResponseWriter, r *http.Request) { - if currentStatusCount < opts.statusReadyCount { - w.WriteHeader(http.StatusBadGateway) - return - } - - w.WriteHeader(http.StatusNoContent) - } - - if opts.statusHandler != nil { - statusHandler = opts.statusHandler - } - - router.HandleFunc("/api/v4/internal/pages/status", statusHandler) pagesHandler := defaultAPIHandler(t, opts) if opts.pagesHandler != nil { diff --git a/test/acceptance/serving_test.go b/test/acceptance/serving_test.go index fb73e03e..77f8118e 100644 --- a/test/acceptance/serving_test.go +++ b/test/acceptance/serving_test.go @@ -387,7 +387,6 @@ func TestDomainsSource(t *testing.T) { configSource string domain string urlSuffix string - readyCount int } type want struct { statusCode int @@ -459,41 +458,12 @@ func TestDomainsSource(t *testing.T) { apiCalled: false, }, }, - { - name: "auto_source_gitlab_is_not_ready", - args: args{ - 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, - content: "main-dir\n", - apiCalled: false, - }, - }, - { - name: "auto_source_gitlab_is_ready", - args: args{ - configSource: "auto", - domain: "new-source-test.gitlab.io", - urlSuffix: "/my/pages/project/", - readyCount: 0, - }, - want: want{ - statusCode: http.StatusOK, - content: "New Pages GitLab Source TEST OK\n", - apiCalled: true, - }, - }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { opts := &stubOpts{ - apiCalled: false, - statusReadyCount: tt.args.readyCount, + apiCalled: false, } source := NewGitlabDomainsSourceStub(t, opts) |