Skip to content

Commit

Permalink
Fix tests with v6 client.
Browse files Browse the repository at this point in the history
  • Loading branch information
winder committed Apr 23, 2019
1 parent 5ee37a7 commit cc59dbd
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions hook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestAsyncHook(t *testing.T) {
}

func TestBulkProcessorHook(t *testing.T) {
hookTest(NewBulkProcessorElasticHook, "async-log", t)
hookTest(NewBulkProcessorElasticHook, "bulk-log", t)
}

func hookTest(hookfunc NewHookFunc, indexName string, t *testing.T) {
Expand Down Expand Up @@ -82,8 +82,13 @@ func hookTest(hookfunc NewHookFunc, indexName string, t *testing.T) {
Query(termQuery).
Do(context.TODO())

if searchResult.Hits.TotalHits != int64(samples) {
t.Errorf("Not all logs pushed to elastic: expected %d got %d", samples, searchResult.Hits.TotalHits)
if err != nil {
t.Errorf("Search error: %v", err)
t.FailNow()
}

if searchResult.TotalHits() != int64(samples) {
t.Errorf("Not all logs pushed to elastic: expected %d got %d", samples, searchResult.TotalHits())
t.FailNow()
}
}
Expand Down Expand Up @@ -120,7 +125,7 @@ func TestError(t *testing.T) {
Query(termQuery).
Do(context.TODO())

if !(searchResult.Hits.TotalHits >= 1) {
if !(searchResult.TotalHits() >= int64(1)) {
t.Error("No log created")
t.FailNow()
}
Expand Down

0 comments on commit cc59dbd

Please sign in to comment.