Skip to content

Commit cb130f5

Browse files
Fix tests
1 parent 24b103d commit cb130f5

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ public void testCancel() throws Exception {
163163
} finally {
164164
SimplePauseFieldPlugin.allowEmitting.countDown();
165165
}
166-
Exception error = expectThrows(Exception.class, requestFuture::actionGet);
167-
assertThat(error.getMessage(), containsString("proxy timeout"));
166+
RemoteComputeException rce = expectThrows(RemoteComputeException.class, requestFuture::actionGet);
167+
assertThat(rce.getCause().getMessage(), containsString("proxy timeout"));
168168
}
169169

170170
public void testSameRemoteClusters() throws Exception {

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,8 @@ public void sendResponse(Exception exception) {
194194
request.includeCCSMetadata(randomBoolean());
195195
{
196196
request.allowPartialResults(false);
197-
Exception error = expectThrows(Exception.class, () -> runQuery(request).close());
197+
RemoteComputeException rce = expectThrows(RemoteComputeException.class, () -> runQuery(request).close());
198+
var error = (Exception) rce.getCause();
198199
var unwrapped = ExceptionsHelper.unwrap(error, simulatedFailure.getClass());
199200
assertNotNull(unwrapped);
200201
assertThat(unwrapped.getMessage(), equalTo(simulatedFailure.getMessage()));
@@ -241,7 +242,8 @@ public void testFailToStartRequestOnRemoteCluster() throws Exception {
241242
request.includeCCSMetadata(randomBoolean());
242243
{
243244
request.allowPartialResults(false);
244-
var error = expectThrows(Exception.class, () -> runQuery(request).close());
245+
var rce = expectThrows(RemoteComputeException.class, () -> runQuery(request).close());
246+
var error = (Exception) rce.getCause();
245247
EsqlTestUtils.assertEsqlFailure(error);
246248
var unwrapped = ExceptionsHelper.unwrap(error, simulatedFailure.getClass());
247249
assertNotNull(unwrapped);

0 commit comments

Comments
 (0)