diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-25 21:14:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-25 21:14:13 +0300 |
commit | 1c635e68ea6fb392244f0d9f8c9dd2c7bd1c95e6 (patch) | |
tree | 052cfeba83f0db195c3861cd3a0173df30bb8a01 /workhorse/internal/upstream | |
parent | d03aeb1110374d140a42622716597ccfa8e4ba57 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'workhorse/internal/upstream')
-rw-r--r-- | workhorse/internal/upstream/upstream_test.go | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/workhorse/internal/upstream/upstream_test.go b/workhorse/internal/upstream/upstream_test.go index 53c15bb7e91..2031fa84ce2 100644 --- a/workhorse/internal/upstream/upstream_test.go +++ b/workhorse/internal/upstream/upstream_test.go @@ -6,6 +6,7 @@ import ( "io/ioutil" "net/http" "net/http/httptest" + "os" "testing" "time" @@ -28,6 +29,14 @@ type testCase struct { expectedResponse string } +func TestMain(m *testing.M) { + // Secret should be configured before any Geo API poll happens to prevent + // race conditions where the first API call happens without a secret path + testhelper.ConfigureSecret() + + os.Exit(m.Run()) +} + func TestRouting(t *testing.T) { handle := func(u *upstream, regex string) routeEntry { handler := http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { @@ -288,11 +297,6 @@ func startWorkhorseServer(railsServerURL string, enableGeoProxyFeature bool) (*h } cfg := newUpstreamConfig(railsServerURL) upstreamHandler := newUpstream(*cfg, logrus.StandardLogger(), myConfigureRoutes) - - // Secret should be configured before the first Geo API poll happens on server start - // to prevent race conditions where the first API call happens without a secret path - testhelper.ConfigureSecret() - ws := httptest.NewServer(upstreamHandler) waitForNextApiPoll := func() {} |