Skip to content

Commit f261864

Browse files
testThatRemoteErrorsAreWrapped: use try to close query response (elastic#131090)
Explicitly close the ES|QL query response obtained in the test to avoid potential leak. (cherry picked from commit f536069) # Conflicts: # muted-tests.yml
1 parent f1f88eb commit f261864

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

muted-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,4 +440,4 @@ tests:
440440
issue: https://github.com/elastic/elasticsearch/issues/127782
441441
- class: org.elasticsearch.search.CCSDuelIT
442442
method: testTerminateAfter
443-
issue: https://github.com/elastic/elasticsearch/issues/126085
443+
issue: https://github.com/elastic/elasticsearch/issues/126085

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)