Skip to content

Commit cc0ea38

Browse files
[8.19] testThatRemoteErrorsAreWrapped: use try to close query response (#131090) (#131106)
* `testThatRemoteErrorsAreWrapped`: use `try` to close query response (#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 * Fix formatting
1 parent 9878abd commit cc0ea38

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

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)