From 1e6234f486132e2502909b9400a0d243370127ef Mon Sep 17 00:00:00 2001 From: Pawan Kartik Date: Fri, 11 Jul 2025 13:04:19 +0100 Subject: [PATCH] `testThatRemoteErrorsAreWrapped`: use `try` to close query response --- muted-tests.yml | 3 --- .../xpack/esql/action/EsqlRemoteErrorWrapIT.java | 7 +++---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/muted-tests.yml b/muted-tests.yml index d1d71b3a760a5..a56c441245d77 100644 --- a/muted-tests.yml +++ b/muted-tests.yml @@ -543,9 +543,6 @@ tests: - class: org.elasticsearch.xpack.esql.action.CrossClusterAsyncQueryStopIT method: testStopQueryLocal issue: https://github.com/elastic/elasticsearch/issues/121672 -- class: org.elasticsearch.xpack.esql.action.EsqlRemoteErrorWrapIT - method: testThatRemoteErrorsAreWrapped - issue: https://github.com/elastic/elasticsearch/issues/130794 - class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT method: test {p0=mtermvectors/10_basic/Tests catching other exceptions per item} issue: https://github.com/elastic/elasticsearch/issues/122414 diff --git a/x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/action/EsqlRemoteErrorWrapIT.java b/x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/action/EsqlRemoteErrorWrapIT.java index bc4d5d35ea71c..f6a9836929f35 100644 --- a/x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/action/EsqlRemoteErrorWrapIT.java +++ b/x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/action/EsqlRemoteErrorWrapIT.java @@ -34,10 +34,9 @@ public void testThatRemoteErrorsAreWrapped() throws Exception { ); } - RemoteException wrappedError = expectThrows( - RemoteException.class, - () -> runQuery("FROM " + REMOTE_CLUSTER_1 + ":*," + REMOTE_CLUSTER_2 + ":* | LIMIT 100", false) - ); + RemoteException wrappedError = expectThrows(RemoteException.class, () -> { + try (EsqlQueryResponse ignored = runQuery("FROM " + REMOTE_CLUSTER_1 + ":*," + REMOTE_CLUSTER_2 + ":* | LIMIT 100", false)) {} + }); assertThat(wrappedError.getMessage(), is("Remote [cluster-a] encountered an error")); } }