Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,6 @@ tests:
- class: org.elasticsearch.compute.aggregation.SumLongGroupingAggregatorFunctionTests
method: testOverflowInGroupingProducesNullAndWarning
issue: https://github.com/elastic/elasticsearch/issues/145438
- class: org.elasticsearch.xpack.esql.action.AsyncEsqlQueryActionIT
method: testCancelOnExpiry
issue: https://github.com/elastic/elasticsearch/issues/145502
- class: org.elasticsearch.xpack.ml.integration.RegressionIT
method: testTwoJobsWithSameRandomizeSeedUseSameTrainingSet
issue: https://github.com/elastic/elasticsearch/issues/145519
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,18 +331,43 @@ public void testUpdateKeepAlive() throws Exception {
}

public void testCancelOnExpiry() throws Exception {
TimeValue keepAlive = timeValueMillis(between(1000, 2000));
var request = asyncEsqlQueryRequest("from test | stats sum(pause_me)").pragmas(queryPragmas())
// small interval so that we can return quickly on submission
.waitForCompletionTimeout(TimeValue.timeValueMillis(between(1, 10)))
.keepOnCompletion(randomBoolean())
.keepAlive(keepAlive);
.allowPartialResults(false)
// large interval so that the tasks won't be cancelled until it has started
.keepAlive(TimeValue.timeValueMinutes(between(1, 5)));
final String asyncId;
scriptPermits.drainPermits();
try {
try (EsqlQueryResponse initialResponse = client().execute(EsqlQueryAction.INSTANCE, request).actionGet(60, TimeUnit.SECONDS)) {
assertThat(initialResponse.isRunning(), is(true));
assertTrue(initialResponse.asyncExecutionId().isPresent());
asyncId = initialResponse.asyncExecutionId().get();
}
// make sure at least one data node driver has started
assertBusy(() -> {
List<TaskInfo> driverTasks = client().admin()
.cluster()
.prepareListTasks()
.setActions(DriverTaskRunner.ACTION_NAME)
.setDetailed(true)
.get()
.getTasks()
.stream()
.filter(d -> d.status().toString().contains("Lucene"))
.toList();
assertThat(driverTasks, not(empty()));
for (TaskInfo driveTask : driverTasks) {
assertFalse(driveTask.cancelled());
}
});
var getRequest = new GetAsyncResultRequest(asyncId).setWaitForCompletionTimeout(TimeValue.timeValueMillis(between(1, 10)))
.setKeepAlive(timeValueMillis(randomIntBetween(1, 100)));
try (var resp = client().execute(EsqlAsyncGetResultAction.INSTANCE, getRequest).actionGet()) {
assertTrue(resp.isRunning());
}
// all the started drivers were canceled
assertBusy(() -> {
List<TaskInfo> tasks = client().admin()
Expand Down
Loading