Skip to content

Commit fee561a

Browse files
Fix Flaky Async Telemetry Test
Resolves #2394
1 parent 52a1a2c commit fee561a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

logging/telemetryhook_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,5 +225,10 @@ func TestAsyncTelemetryHook_QueueDepth(t *testing.T) {
225225
close(filling)
226226
hook.Close()
227227

228-
require.Equal(t, maxDepth, len(testHook.entries()))
228+
hookEntries := len(testHook.entries())
229+
require.GreaterOrEqual(t, hookEntries, maxDepth)
230+
// the anonymous goroutine in createAsyncHookLevels might pull an entry off the pending list before
231+
// writing it off to the underlying hook. when that happens, the total number of sent entries could
232+
// be one higher then the maxDepth.
233+
require.LessOrEqual(t, hookEntries, maxDepth+1)
229234
}

0 commit comments

Comments
 (0)