Skip to content

Commit c93b1fe

Browse files
committed
Fix testStopQueryLocal - always use the same client (same node)
1 parent 952b62e commit c93b1fe

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -517,9 +517,6 @@ tests:
517517
- class: org.elasticsearch.xpack.esql.action.EsqlActionBreakerIT
518518
method: testRowStatsProjectGroupByInt
519519
issue: https://github.com/elastic/elasticsearch/issues/131024
520-
- class: org.elasticsearch.xpack.esql.action.CrossClusterAsyncQueryStopIT
521-
method: testStopQueryLocal
522-
issue: https://github.com/elastic/elasticsearch/issues/121672
523520
- class: org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT
524521
method: test {lookup-join.MvJoinKeyOnFromAfterStats ASYNC}
525522
issue: https://github.com/elastic/elasticsearch/issues/131148

x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/action/CrossClusterAsyncQueryStopIT.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import org.elasticsearch.Build;
1111
import org.elasticsearch.action.ActionFuture;
12+
import org.elasticsearch.client.internal.Client;
1213
import org.elasticsearch.core.Tuple;
1314
import org.elasticsearch.logging.LogManager;
1415
import org.elasticsearch.logging.Logger;
@@ -133,6 +134,9 @@ public void testStopQueryLocal() throws Exception {
133134
int remote2NumShards = (Integer) testClusterInfo.get("remote2.num_shards");
134135
populateRuntimeIndex(LOCAL_CLUSTER, "pause", INDEX_WITH_BLOCKING_MAPPING);
135136

137+
// Gets random node client but ensure it's the same node for all operations
138+
Client client = cluster(LOCAL_CLUSTER).client();
139+
136140
Tuple<Boolean, Boolean> includeCCSMetadata = randomIncludeCCSMetadata();
137141
boolean responseExpectMeta = includeCCSMetadata.v2();
138142
// By default, ES|QL uses all workers in the esql_worker threadpool to execute drivers on data nodes.
@@ -145,7 +149,7 @@ public void testStopQueryLocal() throws Exception {
145149
int maxEsqlWorkers = threadpool.info(EsqlPlugin.ESQL_WORKER_THREAD_POOL_NAME).getMax();
146150
LOGGER.info("--> Launching async query");
147151
final String asyncExecutionId = startAsyncQueryWithPragmas(
148-
client(),
152+
client,
149153
"FROM blocking,*:logs-* | STATS total=sum(coalesce(const,v)) | LIMIT 1",
150154
includeCCSMetadata.v1(),
151155
Map.of(QueryPragmas.TASK_CONCURRENCY.getKey(), between(1, maxEsqlWorkers - 1))
@@ -157,9 +161,9 @@ public void testStopQueryLocal() throws Exception {
157161

158162
// wait until the remotes are done
159163
LOGGER.info("--> Waiting for remotes", asyncExecutionId);
160-
waitForCluster(client(), REMOTE_CLUSTER_1, asyncExecutionId);
164+
waitForCluster(client, REMOTE_CLUSTER_1, asyncExecutionId);
161165
LOGGER.info("--> Remote 1 done", asyncExecutionId);
162-
waitForCluster(client(), REMOTE_CLUSTER_2, asyncExecutionId);
166+
waitForCluster(client, REMOTE_CLUSTER_2, asyncExecutionId);
163167
LOGGER.info("--> Remote 2 done", asyncExecutionId);
164168

165169
/* at this point:
@@ -169,10 +173,10 @@ public void testStopQueryLocal() throws Exception {
169173
// run the stop query
170174
AsyncStopRequest stopRequest = new AsyncStopRequest(asyncExecutionId);
171175
LOGGER.info("Launching stop for {}", asyncExecutionId);
172-
ActionFuture<EsqlQueryResponse> stopAction = client().execute(EsqlAsyncStopAction.INSTANCE, stopRequest);
176+
ActionFuture<EsqlQueryResponse> stopAction = client.execute(EsqlAsyncStopAction.INSTANCE, stopRequest);
173177
// ensure stop operation is running
174178
assertBusy(() -> {
175-
try (EsqlQueryResponse asyncResponse = getAsyncResponse(client(), asyncExecutionId)) {
179+
try (EsqlQueryResponse asyncResponse = getAsyncResponse(client, asyncExecutionId)) {
176180
EsqlExecutionInfo executionInfo = asyncResponse.getExecutionInfo();
177181
LOGGER.info("--> Waiting for stop operation to start, current status: {}", executionInfo);
178182
assertNotNull(executionInfo);
@@ -216,7 +220,7 @@ public void testStopQueryLocal() throws Exception {
216220
}
217221
} finally {
218222
SimplePauseFieldPlugin.allowEmitting.countDown();
219-
assertAcked(deleteAsyncId(client(), asyncExecutionId));
223+
assertAcked(deleteAsyncId(client, asyncExecutionId));
220224
}
221225
}
222226

0 commit comments

Comments
 (0)