Skip to content

Commit

Permalink
contrib/google.golang.org/grpc: fix flaky tests by removing arbitrary…
Browse files Browse the repository at this point in the history
… sleeps (#2584)

Co-authored-by: Katie Hockman <[email protected]>
  • Loading branch information
Julio-Guerra and katiehockman authored Feb 29, 2024
1 parent 8373eb9 commit 35aa850
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions contrib/google.golang.org/grpc/grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -658,15 +658,7 @@ func newRig(traceClient bool, opts ...Option) (*rig, error) {
// waitForSpans polls the mock tracer until the expected number of spans
// appears
func waitForSpans(mt mocktracer.Tracer, sz int) {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
defer cancel()

for len(mt.FinishedSpans()) < sz {
select {
case <-ctx.Done():
return
default:
}
time.Sleep(time.Millisecond * 100)
}
}
Expand Down Expand Up @@ -1332,8 +1324,5 @@ func TestIssue2050(t *testing.T) {
select {
case <-spansFound:
return

case <-time.After(5 * time.Second):
assert.Fail(t, "spans not found")
}
}

0 comments on commit 35aa850

Please sign in to comment.