Skip to content

Commit

Permalink
Increase the wait so that the index will have time to commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lr-paul committed Aug 27, 2015
1 parent 8f8c8e8 commit 2ff9956
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/corebulk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ func TestBulkIndexerBasic(t *testing.T) {
}

err := indexer.Index(testIndex, "user", "1", "", "", &date, data, true)

waitFor(func() bool {
return len(buffers) > 0
}, 5)

// part of request is url, so lets factor that in
//totalBytesSent = totalBytesSent - len(*eshost)
assert.T(t, len(buffers) == 1, fmt.Sprintf("Should have sent one operation but was %d", len(buffers)))
Expand All @@ -88,7 +88,10 @@ func TestBulkIndexerBasic(t *testing.T) {
assert.T(t, totalBytesSent == expectedBytes, fmt.Sprintf("Should have sent %v bytes but was %v", expectedBytes, totalBytesSent))

err = indexer.Index(testIndex, "user", "2", "", "", nil, data, true)
<-time.After(time.Millisecond * 10) // we need to wait for doc to hit send channel
waitFor(func() bool {
return len(buffers) > 1
}, 5)

// this will test to ensure that Flush actually catches a doc
indexer.Flush()
totalBytesSent = totalBytesSent - len(*eshost)
Expand Down

0 comments on commit 2ff9956

Please sign in to comment.