File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -246,14 +246,16 @@ func TestHealthMetricsRaceCondition(t *testing.T) {
246246 sp .Finish ()
247247 }()
248248 }
249- time .Sleep (150 * time .Millisecond )
250- flush (5 )
251- tg .Wait (assert , 10 , 100 * time .Millisecond )
252249 wg .Wait ()
250+ flush (5 )
253251
254- counts := tg .Counts ()
255- assert .Equal (int64 (5 ), counts ["datadog.tracer.spans_started" ])
256- assert .Equal (int64 (5 ), counts ["datadog.tracer.spans_finished" ])
252+ cond := func () bool {
253+ counts := tg .Counts ()
254+ return counts ["datadog.tracer.spans_started" ] == 5 && counts ["datadog.tracer.spans_finished" ] == 5
255+ }
256+ assert .Eventually (cond , 5 * time .Second , time .Millisecond )
257+ time .Sleep (10 * time .Millisecond )
258+ assert .True (cond ())
257259
258260 assertSpanMetricCountsAreZero (t , tracer .spansStarted )
259261 assertSpanMetricCountsAreZero (t , tracer .spansFinished )
You can’t perform that action at this time.
0 commit comments