diff --git a/logging/telemetryhook_test.go b/logging/telemetryhook_test.go index 083df03c53..93b6b1aa62 100644 --- a/logging/telemetryhook_test.go +++ b/logging/telemetryhook_test.go @@ -225,5 +225,10 @@ func TestAsyncTelemetryHook_QueueDepth(t *testing.T) { close(filling) hook.Close() - require.Equal(t, maxDepth, len(testHook.entries())) + hookEntries := len(testHook.entries()) + require.GreaterOrEqual(t, hookEntries, maxDepth) + // the anonymous goroutine in createAsyncHookLevels might pull an entry off the pending list before + // writing it off to the underlying hook. when that happens, the total number of sent entries could + // be one higher then the maxDepth. + require.LessOrEqual(t, hookEntries, maxDepth+1) }