Skip to content

Commit

Permalink
sdk/log: Fix TestBatchProcessor/ForceFlush/ErrorPartialFlush flaky te…
Browse files Browse the repository at this point in the history
…st (#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>
  • Loading branch information
amanakin and MrAlias authored May 30, 2024
1 parent 525fedb commit 8d4d3c8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sdk/log/batch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 8d4d3c8

Please sign in to comment.