Skip to content

Commit

Permalink
Replace awaitBusy with assertBusy in atLeastDocsIndexed (#38190)
Browse files Browse the repository at this point in the history
Unlike assertBusy, awaitBusy does not retry if the code-block throws an
AssertionError. A refresh in atLeastDocsIndexed can fail because we call
this method while we are closing some node in FollowerFailOverIT.
  • Loading branch information
dnhatn authored Feb 1, 2019
1 parent 92303bc commit 1a8a728
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -490,14 +490,14 @@ private Map<Integer, List<DocIdSeqNoAndTerm>> getDocIdAndSeqNos(InternalTestClus
return docs;
}

protected void atLeastDocsIndexed(Client client, String index, long numDocsReplicated) throws InterruptedException {
protected void atLeastDocsIndexed(Client client, String index, long numDocsReplicated) throws Exception {
logger.info("waiting for at least [{}] documents to be indexed into index [{}]", numDocsReplicated, index);
awaitBusy(() -> {
assertBusy(() -> {
refresh(client, index);
SearchRequest request = new SearchRequest(index);
request.source(new SearchSourceBuilder().size(0));
SearchResponse response = client.search(request).actionGet();
return response.getHits().getTotalHits() >= numDocsReplicated;
assertThat(response.getHits().getTotalHits(), greaterThanOrEqualTo(numDocsReplicated));
}, 60, TimeUnit.SECONDS);
}

Expand Down

0 comments on commit 1a8a728

Please sign in to comment.