Skip to content

Commit 736fc6f

Browse files
pawankartik-elasticmridula-s109
authored andcommitted
testThatRemoteErrorsAreWrapped: use try to close query response (elastic#131090)
Explicitly close the ES|QL query response obtained in the test to avoid potential leak.
1 parent e8f7cac commit 736fc6f

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -537,9 +537,6 @@ tests:
537537
- class: org.elasticsearch.xpack.esql.action.CrossClusterAsyncQueryStopIT
538538
method: testStopQueryLocal
539539
issue: https://github.com/elastic/elasticsearch/issues/121672
540-
- class: org.elasticsearch.xpack.esql.action.EsqlRemoteErrorWrapIT
541-
method: testThatRemoteErrorsAreWrapped
542-
issue: https://github.com/elastic/elasticsearch/issues/130794
543540
- class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT
544541
method: test {p0=mtermvectors/10_basic/Tests catching other exceptions per item}
545542
issue: https://github.com/elastic/elasticsearch/issues/122414

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,9 @@ public void testThatRemoteErrorsAreWrapped() throws Exception {
3434
);
3535
}
3636

37-
RemoteException wrappedError = expectThrows(
38-
RemoteException.class,
39-
() -> runQuery("FROM " + REMOTE_CLUSTER_1 + ":*," + REMOTE_CLUSTER_2 + ":* | LIMIT 100", false)
40-
);
37+
RemoteException wrappedError = expectThrows(RemoteException.class, () -> {
38+
try (EsqlQueryResponse ignored = runQuery("FROM " + REMOTE_CLUSTER_1 + ":*," + REMOTE_CLUSTER_2 + ":* | LIMIT 100", false)) {}
39+
});
4140
assertThat(wrappedError.getMessage(), is("Remote [cluster-a] encountered an error"));
4241
}
4342
}

0 commit comments

Comments
 (0)