Skip to content

Commit

Permalink
test bulkCollectPublishFails stats
Browse files Browse the repository at this point in the history
  • Loading branch information
graphaelli committed Aug 24, 2018
1 parent a397c1f commit 97cb68c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libbeat/outputs/elasticsearch/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,12 @@ func TestCollectPublishFailMiddle(t *testing.T) {
events := []publisher.Event{event, eventFail, event}

reader := newJSONReader(response)
res, _ := bulkCollectPublishFails(reader, events)
res, stats := bulkCollectPublishFails(reader, events)
assert.Equal(t, 1, len(res))
if len(res) == 1 {
assert.Equal(t, eventFail, res[0])
}
assert.Equal(t, stats, bulkResultStats{acked: 2, fails: 1, tooMany: 1})
}

func TestCollectPublishFailAll(t *testing.T) {
Expand All @@ -139,9 +140,10 @@ func TestCollectPublishFailAll(t *testing.T) {
events := []publisher.Event{event, event, event}

reader := newJSONReader(response)
res, _ := bulkCollectPublishFails(reader, events)
res, stats := bulkCollectPublishFails(reader, events)
assert.Equal(t, 3, len(res))
assert.Equal(t, events, res)
assert.Equal(t, stats, bulkResultStats{fails: 3, tooMany: 3})
}

func TestCollectPipelinePublishFail(t *testing.T) {
Expand Down

0 comments on commit 97cb68c

Please sign in to comment.