Skip to content

Commit

Permalink
tests: fix small unit test race
Browse files Browse the repository at this point in the history
Starting the httptest.Server then changing the
config can apparently lead to intermittant race
condition.

Signed-off-by: crozzy <joseph.crosland@gmail.com>
  • Loading branch information
crozzy authored and ldelossa committed Apr 19, 2021
1 parent 6e50ec2 commit 08734ab
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion httptransport/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@ func TestUpdateEndpoints(t *testing.T) {
if err := s.configureMatcherMode(ctx); err != nil {
t.Error(err)
}
srv := httptest.NewServer(s)
srv := httptest.NewUnstartedServer(s)
srv.Config.BaseContext = func(_ net.Listener) context.Context {
return ctx
}
srv.Start()
defer srv.Close()
u, err := url.Parse(srv.URL)
if err != nil {
Expand Down

0 comments on commit 08734ab

Please sign in to comment.