Fix panic when rejecting empty batch (#5524)

This commit is contained in:
Daniel Nelson
2019-03-04 12:36:19 -08:00
committed by GitHub
parent c0e0da7ef6
commit 0b5811e193
2 changed files with 18 additions and 1 deletions

View File

@@ -714,3 +714,15 @@ func TestBuffer_AddOverwriteAndRejectOffset(t *testing.T) {
require.Equal(t, 13, reject)
require.Equal(t, 5, accept)
}
func TestBuffer_RejectEmptyBatch(t *testing.T) {
b := setup(NewBuffer("test", 5))
batch := b.Batch(2)
b.Add(MetricTime(1))
b.Reject(batch)
b.Add(MetricTime(2))
batch = b.Batch(2)
for _, m := range batch {
require.NotNil(t, m)
}
}