diff options
Diffstat (limited to 'workhorse/internal/upstream/upstream_test.go')
-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() {} |