diff options
author | Tsachi Herman <tsachi.herman@algorand.com> | 2022-01-07 10:51:03 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-07 10:51:03 -0500 |
commit | 46784c7c25b9900a6dac694ff040ae525e1fa884 (patch) | |
tree | fabce7fcfdb411559f1eabb15a07efb5d690105e | |
parent | ab656117bc5693433568c38c63d5b65ef5c2c7e1 (diff) |
testing: Fix unit test TestAsyncTelemetryHook_QueueDepth (#2685)
Fix the unit test TestAsyncTelemetryHook_QueueDepth
-rw-r--r-- | logging/telemetryhook_test.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/logging/telemetryhook_test.go b/logging/telemetryhook_test.go index 85e776867..1846ed6f4 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) } |