diff options
author | feistel <6742251-feistel@users.noreply.gitlab.com> | 2022-06-28 15:29:08 +0300 |
---|---|---|
committer | feistel <6742251-feistel@users.noreply.gitlab.com> | 2022-06-28 15:29:08 +0300 |
commit | 54d8efbe3408d265fcabea612df3c87a5440c28f (patch) | |
tree | 77b5bbb68b88879baff14590948d450137a5376d /test/acceptance | |
parent | 7fd2e59052a24e8b2a78e4af87f292b3d8c1f8b3 (diff) |
Fix Flaky TestDomainResolverError race
Diffstat (limited to 'test/acceptance')
-rw-r--r-- | test/acceptance/serving_test.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/test/acceptance/serving_test.go b/test/acceptance/serving_test.go index c7aed337..84808f46 100644 --- a/test/acceptance/serving_test.go +++ b/test/acceptance/serving_test.go @@ -378,7 +378,7 @@ func TestDomainResolverError(t *testing.T) { for name, test := range tests { t.Run(name, func(t *testing.T) { - called := false + called := make(chan struct{}) // handler setup pagesHandler := func(w http.ResponseWriter, r *http.Request) { @@ -387,7 +387,7 @@ func TestDomainResolverError(t *testing.T) { return } - called = true + close(called) if test.panic { panic("server failed") @@ -413,7 +413,11 @@ func TestDomainResolverError(t *testing.T) { require.NoError(t, err) testhelpers.Close(t, response.Body) - require.True(t, called, "api must have been called") + select { + case <-called: + case <-time.After(2 * time.Second): + t.Fatal("timed out waiting for the pages handler") + } require.Equal(t, http.StatusBadGateway, response.StatusCode) |