1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-10-31 00:07:40 +02:00

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 <MrAlias@users.noreply.github.com>
This commit is contained in:
Anton Manakin
2024-05-30 17:40:19 +03:00
committed by GitHub
parent 525fedbb26
commit 8d4d3c875c

View File

@@ -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.