Skip to content

Commit

Permalink
Merge pull request 99designs#446 from 99designs/fix-flakey-test
Browse files Browse the repository at this point in the history
Fix flakey goroutine test
  • Loading branch information
vektah authored Nov 26, 2018
2 parents df1b571 + 5fb4c6d commit 856740b
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 856740b

Please sign in to comment.