Skip to content
Merged
3 changes: 0 additions & 3 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,6 @@ tests:
- class: org.elasticsearch.packaging.test.DockerTests
method: test025SyncPluginsUsingProxy
issue: https://github.com/elastic/elasticsearch/issues/127138
- class: org.elasticsearch.xpack.remotecluster.RemoteClusterSecurityRestIT
method: testTaskCancellation
issue: https://github.com/elastic/elasticsearch/issues/128009
- class: org.elasticsearch.xpack.esql.action.CrossClusterQueryWithPartialResultsIT
method: testOneRemoteClusterPartial
issue: https://github.com/elastic/elasticsearch/issues/124055
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ public void testTaskCancellation() throws Exception {
final String indexName = "index_fulfilling";
final String roleName = "taskCancellationRoleName";
final String userName = "taskCancellationUsername";
String asyncSearchOpaqueId = "async-search-opaque-id-" + randomUUID();
try {
// create some index on the fulfilling cluster, to be searched from the querying cluster
{
Expand Down Expand Up @@ -206,13 +207,12 @@ public void testTaskCancellation() throws Exception {
{
"name": "*:*",
"error_type": "exception",
"stall_time_seconds": 60
"stall_time_seconds": 10
}
]
}
}
}""");
String asyncSearchOpaqueId = "async-search-opaque-id-" + randomUUID();
submitAsyncSearchRequest.setOptions(
RequestOptions.DEFAULT.toBuilder()
.addHeader("Authorization", headerFromRandomAuthMethod(userName, PASS))
Expand Down Expand Up @@ -308,6 +308,27 @@ public void testTaskCancellation() throws Exception {
assertOK(adminClient().performRequest(new Request("DELETE", "/_security/user/" + userName)));
assertOK(adminClient().performRequest(new Request("DELETE", "/_security/role/" + roleName)));
assertOK(performRequestAgainstFulfillingCluster(new Request("DELETE", indexName)));
// wait for search related tasks to finish on the query cluster
assertBusy(() -> {
try {
Response queryingClusterTasks = adminClient().performRequest(new Request("GET", "/_tasks"));
assertOK(queryingClusterTasks);
Map<String, Object> responseMap = XContentHelper.convertToMap(
JsonXContent.jsonXContent,
EntityUtils.toString(queryingClusterTasks.getEntity()),
false
);
AtomicBoolean searchTasksFound = new AtomicBoolean(false);
selectTasksWithOpaqueId(responseMap, asyncSearchOpaqueId, task -> {
if (task.get("action") instanceof String action && action.contains("indices:data/read/search")) {
searchTasksFound.set(true);
}
});
assertFalse("Expected no search tasks to be running", searchTasksFound.get());
} catch (IOException e) {
throw new RuntimeException(e);
}
});
}
}

Expand Down