Skip to content

Commit

Permalink
Fix flakey goroutine test
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Scarr committed Nov 26, 2018
1 parent 4b08251 commit 8a5039d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion codegen/testserver/generated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,10 @@ func TestGeneratedServer(t *testing.T) {
sub.Close()

// need a little bit of time for goroutines to settle
time.Sleep(200 * time.Millisecond)
start := time.Now()
for time.Since(start).Seconds() < 2 && initialGoroutineCount != runtime.NumGoroutine() {
time.Sleep(5 * time.Millisecond)
}

require.Equal(t, initialGoroutineCount, runtime.NumGoroutine())
})
Expand Down

0 comments on commit 8a5039d

Please sign in to comment.