Skip to content

Fix session leak in PeersV2NodeRefreshIT test #294

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,18 @@ public static void tearDown() {
@Test
public void should_successfully_send_peers_v2_node_refresh_query()
throws InterruptedException, ExecutionException {
CqlSession session =
CqlSession.builder().addContactPoint(cluster.node(1).inetSocketAddress()).build();
Node node = findNonControlNode(session);
((InternalDriverContext) session.getContext())
.getMetadataManager()
.refreshNode(node)
.toCompletableFuture()
.get();
assertThat(hasNodeRefreshQuery())
.describedAs("Expecting peers_v2 node refresh query to be present but it wasn't")
.isTrue();
try (CqlSession session =
CqlSession.builder().addContactPoint(cluster.node(1).inetSocketAddress()).build()) {
Node node = findNonControlNode(session);
((InternalDriverContext) session.getContext())
.getMetadataManager()
.refreshNode(node)
.toCompletableFuture()
.get();
assertThat(hasNodeRefreshQuery())
.describedAs("Expecting peers_v2 node refresh query to be present but it wasn't")
.isTrue();
}
}

private Node findNonControlNode(CqlSession session) {
Expand Down
Loading