mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-09 06:25:07 +00:00
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.
This commit is contained in:
parent
ee57420de6
commit
f64b20383e
@ -487,14 +487,15 @@ public abstract class CcrIntegTestCase extends ESTestCase {
|
|||||||
return docs;
|
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);
|
logger.info("waiting for at least [{}] documents to be indexed into index [{}]", numDocsReplicated, index);
|
||||||
awaitBusy(() -> {
|
assertBusy(() -> {
|
||||||
refresh(client, index);
|
refresh(client, index);
|
||||||
SearchRequest request = new SearchRequest(index);
|
SearchRequest request = new SearchRequest(index);
|
||||||
request.source(new SearchSourceBuilder().size(0));
|
request.source(new SearchSourceBuilder().size(0));
|
||||||
SearchResponse response = client.search(request).actionGet();
|
SearchResponse response = client.search(request).actionGet();
|
||||||
return response.getHits().getTotalHits().value >= numDocsReplicated;
|
assertNotNull(response.getHits().getTotalHits());
|
||||||
|
assertThat(response.getHits().getTotalHits().value, greaterThanOrEqualTo(numDocsReplicated));
|
||||||
}, 60, TimeUnit.SECONDS);
|
}, 60, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user