Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
improvement: Fix flakiness on CassandraClientPoolTest resilientToRoll…
Browse files Browse the repository at this point in the history
…ingRestarts method (#7036)

CassandraClientPoolTest resilientToRollingRestarts() method shouldn't be flaky anymore.
  • Loading branch information
LucasIME authored Mar 19, 2024
1 parent c199047 commit 4c976cf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,10 @@ public void successfulRequestCausesHostToBeRemovedFromBlacklist() {

@Test
public void resilientToRollingRestarts() {
CassandraClientPool cassandraClientPool =
clientPoolWithServersInCurrentPool(ImmutableSet.of(CASS_SERVER_1, CASS_SERVER_2));
when(config.autoRefreshNodes()).thenReturn(false);
CassandraClientPool cassandraClientPool = clientPoolWithServersInConfigAndCurrentPool(
Set.of(HOST_1, HOST_2), ImmutableSet.of(CASS_SERVER_1, CASS_SERVER_2));

AtomicReference<CassandraServer> downHost = new AtomicReference<>(CASS_SERVER_1);
cassandraClientPool
.getCurrentPools()
Expand Down Expand Up @@ -643,6 +645,11 @@ private CassandraClientPoolImpl clientPoolWithInitialProxies(Set<InetSocketAddre
return clientPoolWith(proxies, ImmutableSet.of(), Optional.empty());
}

private CassandraClientPoolImpl clientPoolWithServersInConfigAndCurrentPool(
Set<InetSocketAddress> addresses, Set<CassandraServer> servers) {
return clientPoolWith(addresses, servers, Optional.empty());
}

private CassandraClientPoolImpl clientPoolWithServersInCurrentPool(Set<CassandraServer> servers) {
return clientPoolWith(ImmutableSet.of(), servers, Optional.empty());
}
Expand Down
6 changes: 6 additions & 0 deletions changelog/@unreleased/pr-7036.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type: improvement
improvement:
description: CassandraClientPoolTest resilientToRollingRestarts() method shouldn't
be flaky anymore.
links:
- https://github.com/palantir/atlasdb/pull/7036

0 comments on commit 4c976cf

Please sign in to comment.