From 8d4d3c875c6572945a23ff404d99e605f174afff Mon Sep 17 00:00:00 2001 From: Anton Manakin <45166364+amanakin@users.noreply.github.com> Date: Thu, 30 May 2024 17:40:19 +0300 Subject: [PATCH] sdk/log: Fix TestBatchProcessor/ForceFlush/ErrorPartialFlush flaky test (#5416) Fix #5342 Run of `go test -v -timeout 10s -short -count=10000 ./... -run='TestBatchProcessor/ForceFlush/ErrorPartialFlush'` **Before**: Failed with `panic: test timed out after 10s` **After**: Passed Problem was with `bufferExporter.input` chan. In test expected: > 1 export being performed, 1 export in buffer chan, >1 batch But buffer chan wasn't checked. Now we ensure, that record is in buffer chan Co-authored-by: Tyler Yahn --- sdk/log/batch_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/log/batch_test.go b/sdk/log/batch_test.go index c15e3d01446..70b12ab04fa 100644 --- a/sdk/log/batch_test.go +++ b/sdk/log/batch_test.go @@ -384,7 +384,7 @@ func TestBatchProcessor(t *testing.T) { require.NoError(t, b.OnEmit(ctx, Record{})) } assert.Eventually(t, func() bool { - return e.ExportN() > 0 + return e.ExportN() > 0 && len(b.exporter.input) == cap(b.exporter.input) }, 2*time.Second, time.Microsecond) // 1 export being performed, 1 export in buffer chan, >1 batch // still in queue that an attempt to flush will be made on.