From 4c976cf34c91695e6410c81fd5ba2a35053ffc0a Mon Sep 17 00:00:00 2001 From: Lucas Sousa Meireles Date: Tue, 19 Mar 2024 14:18:47 +0000 Subject: [PATCH] improvement: Fix flakiness on CassandraClientPoolTest resilientToRollingRestarts method (#7036) CassandraClientPoolTest resilientToRollingRestarts() method shouldn't be flaky anymore. --- .../keyvalue/cassandra/CassandraClientPoolTest.java | 11 +++++++++-- changelog/@unreleased/pr-7036.v2.yml | 6 ++++++ 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 changelog/@unreleased/pr-7036.v2.yml diff --git a/atlasdb-cassandra/src/test/java/com/palantir/atlasdb/keyvalue/cassandra/CassandraClientPoolTest.java b/atlasdb-cassandra/src/test/java/com/palantir/atlasdb/keyvalue/cassandra/CassandraClientPoolTest.java index bc7d079124f..50f39fac79e 100644 --- a/atlasdb-cassandra/src/test/java/com/palantir/atlasdb/keyvalue/cassandra/CassandraClientPoolTest.java +++ b/atlasdb-cassandra/src/test/java/com/palantir/atlasdb/keyvalue/cassandra/CassandraClientPoolTest.java @@ -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 downHost = new AtomicReference<>(CASS_SERVER_1); cassandraClientPool .getCurrentPools() @@ -643,6 +645,11 @@ private CassandraClientPoolImpl clientPoolWithInitialProxies(Set addresses, Set servers) { + return clientPoolWith(addresses, servers, Optional.empty()); + } + private CassandraClientPoolImpl clientPoolWithServersInCurrentPool(Set servers) { return clientPoolWith(ImmutableSet.of(), servers, Optional.empty()); } diff --git a/changelog/@unreleased/pr-7036.v2.yml b/changelog/@unreleased/pr-7036.v2.yml new file mode 100644 index 00000000000..f68876e7bdb --- /dev/null +++ b/changelog/@unreleased/pr-7036.v2.yml @@ -0,0 +1,6 @@ +type: improvement +improvement: + description: CassandraClientPoolTest resilientToRollingRestarts() method shouldn't + be flaky anymore. + links: + - https://github.com/palantir/atlasdb/pull/7036