Skip to content

Commit 14e21c8

Browse files
authored
Merge branch 'main' into fuse_mv_min_max
2 parents 2363e73 + 8e4ad76 commit 14e21c8

File tree

1 file changed

+4
-42
lines changed
  • x-pack/plugin/esql/qa/server/multi-clusters/src/javaRestTest/java/org/elasticsearch/xpack/esql/ccq

1 file changed

+4
-42
lines changed

x-pack/plugin/esql/qa/server/multi-clusters/src/javaRestTest/java/org/elasticsearch/xpack/esql/ccq/MultiClusterSpecIT.java

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import org.elasticsearch.Version;
1616
import org.elasticsearch.client.Request;
1717
import org.elasticsearch.client.Response;
18-
import org.elasticsearch.client.ResponseListener;
1918
import org.elasticsearch.client.RestClient;
2019
import org.elasticsearch.common.settings.Settings;
2120
import org.elasticsearch.core.IOUtils;
@@ -39,8 +38,6 @@
3938
import java.util.List;
4039
import java.util.Locale;
4140
import java.util.Set;
42-
import java.util.concurrent.CompletableFuture;
43-
import java.util.concurrent.ExecutionException;
4441
import java.util.regex.Pattern;
4542
import java.util.stream.Collectors;
4643

@@ -254,7 +251,10 @@ static RestClient twoClients(RestClient localClient, RestClient remoteClient) th
254251
return bulkClient.performRequest(request);
255252
} else {
256253
Request[] clones = cloneRequests(request, 2);
257-
return runInParallel(localClient, remoteClient, clones);
254+
Response resp1 = remoteClient.performRequest(clones[0]);
255+
Response resp2 = localClient.performRequest(clones[1]);
256+
assertEquals(resp1.getStatusLine().getStatusCode(), resp2.getStatusLine().getStatusCode());
257+
return resp2;
258258
}
259259
});
260260
doAnswer(invocation -> {
@@ -289,44 +289,6 @@ static Request[] cloneRequests(Request orig, int numClones) throws IOException {
289289
return clones;
290290
}
291291

292-
/**
293-
* Run {@link #cloneRequests cloned} requests in parallel.
294-
*/
295-
static Response runInParallel(RestClient localClient, RestClient remoteClient, Request[] clones) throws Throwable {
296-
CompletableFuture<Response> remoteResponse = new CompletableFuture<>();
297-
CompletableFuture<Response> localResponse = new CompletableFuture<>();
298-
remoteClient.performRequestAsync(clones[0], new ResponseListener() {
299-
@Override
300-
public void onSuccess(Response response) {
301-
remoteResponse.complete(response);
302-
}
303-
304-
@Override
305-
public void onFailure(Exception exception) {
306-
remoteResponse.completeExceptionally(exception);
307-
}
308-
});
309-
localClient.performRequestAsync(clones[1], new ResponseListener() {
310-
@Override
311-
public void onSuccess(Response response) {
312-
localResponse.complete(response);
313-
}
314-
315-
@Override
316-
public void onFailure(Exception exception) {
317-
localResponse.completeExceptionally(exception);
318-
}
319-
});
320-
try {
321-
Response remote = remoteResponse.get();
322-
Response local = localResponse.get();
323-
assertEquals(remote.getStatusLine().getStatusCode(), local.getStatusLine().getStatusCode());
324-
return local;
325-
} catch (ExecutionException e) {
326-
throw e.getCause();
327-
}
328-
}
329-
330292
/**
331293
* Convert FROM employees ... => FROM *:employees,employees
332294
*/

0 commit comments

Comments
 (0)