Skip to content

Commit d16c667

Browse files
committed
Replace awaitBusy with assertBusy in atLeastDocsIndexed (#38190)
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.
1 parent abb1c56 commit d16c667

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/CcrIntegTestCase.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -477,14 +477,14 @@ private Map<Integer, List<DocIdSeqNoAndTerm>> getDocIdAndSeqNos(InternalTestClus
477477
return docs;
478478
}
479479

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

0 commit comments

Comments
 (0)