From 97cb68c0b00f8424e39387bba8cfc2821070b471 Mon Sep 17 00:00:00 2001 From: Gil Raphaelli Date: Fri, 24 Aug 2018 15:09:58 -0400 Subject: [PATCH] test bulkCollectPublishFails stats --- libbeat/outputs/elasticsearch/client_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libbeat/outputs/elasticsearch/client_test.go b/libbeat/outputs/elasticsearch/client_test.go index 0c92d17b100..dd1d5104a00 100644 --- a/libbeat/outputs/elasticsearch/client_test.go +++ b/libbeat/outputs/elasticsearch/client_test.go @@ -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) { @@ -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) {