Skip to content

Commit 1a8a728

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 92303bc commit 1a8a728

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,14 +490,14 @@ private Map<Integer, List<DocIdSeqNoAndTerm>> getDocIdAndSeqNos(InternalTestClus
490490
return docs;
491491
}
492492

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

0 commit comments

Comments
 (0)