use of org.opensearch.common.unit.TimeValue.timeValueSeconds in project OpenSearch by opensearch-project.
the class AsyncBulkByScrollActionTests method testStartNextScrollRetriesOnRejectionButFailsOnTooManyRejections.
public void testStartNextScrollRetriesOnRejectionButFailsOnTooManyRejections() throws Exception {
// this test primarily tests ClientScrollableHitSource but left it to test integration to status
client.scrollsToReject = testRequest.getMaxRetries() + randomIntBetween(1, 100);
assertExactlyOnce(onFail -> {
Consumer<Exception> validingOnFail = e -> {
assertNotNull(ExceptionsHelper.unwrap(e, OpenSearchRejectedExecutionException.class));
onFail.run();
};
ClientScrollableHitSource hitSource = new ClientScrollableHitSource(logger, buildTestBackoffPolicy(), threadPool, testTask.getWorkerState()::countSearchRetry, r -> fail(), validingOnFail, new ParentTaskAssigningClient(client, localNode, testTask), testRequest.getSearchRequest());
hitSource.setScroll(scrollId());
hitSource.startNextScroll(TimeValue.timeValueSeconds(0));
assertBusy(() -> assertEquals(testRequest.getMaxRetries() + 1, client.scrollAttempts.get()));
});
assertNull("There shouldn't be a scroll attempt pending that we didn't reject", client.lastScroll.get());
assertEquals(testRequest.getMaxRetries(), testTask.getStatus().getSearchRetries());
}
Aggregations