Skip to content

Commit

Permalink
Add test to reproduce issue
Browse files Browse the repository at this point in the history
  • Loading branch information
gzuidhof committed Nov 21, 2024
1 parent 28f727d commit b9c6205
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions batcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,4 +282,17 @@ func TestBatcherCancellation(t *testing.T) {
assert.ErrorIs(t, batcher.Push(0), ErrBatcherStopped)
assert.Equal(t, 0, batcher.CurrentBufferSize())
})

t.Run("no empty flush after cancellation", func(t *testing.T) {
t.Parallel()
ctx, cancel := context.WithCancel(context.Background())

_, flusher := startWithMockFlusher(ctx, t, New[int]())

cancel()

time.Sleep(time.Millisecond * 5)

assert.Equal(t, 0, flusher.StartCount())
})
}

0 comments on commit b9c6205

Please sign in to comment.