Skip to content

Commit f64b203

Browse files
authored
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 ee57420 commit f64b203

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

+4-3
Original file line numberDiff line numberDiff line change
@@ -487,14 +487,15 @@ private Map<Integer, List<DocIdSeqNoAndTerm>> getDocIdAndSeqNos(InternalTestClus
487487
return docs;
488488
}
489489

490-
protected void atLeastDocsIndexed(Client client, String index, long numDocsReplicated) throws InterruptedException {
490+
protected void atLeastDocsIndexed(Client client, String index, long numDocsReplicated) throws Exception {
491491
logger.info("waiting for at least [{}] documents to be indexed into index [{}]", numDocsReplicated, index);
492-
awaitBusy(() -> {
492+
assertBusy(() -> {
493493
refresh(client, index);
494494
SearchRequest request = new SearchRequest(index);
495495
request.source(new SearchSourceBuilder().size(0));
496496
SearchResponse response = client.search(request).actionGet();
497-
return response.getHits().getTotalHits().value >= numDocsReplicated;
497+
assertNotNull(response.getHits().getTotalHits());
498+
assertThat(response.getHits().getTotalHits().value, greaterThanOrEqualTo(numDocsReplicated));
498499
}, 60, TimeUnit.SECONDS);
499500
}
500501

0 commit comments

Comments
 (0)