Skip to content

Commit 4fd4dc2

Browse files
dkropachevclaude
andcommitted
IT: fix flaky HeartbeatTests.HeartbeatFailed test
Use 1 connection per host instead of the default per-shard pool to avoid asynchronous shard-aware connection establishment racing with the baseline connection count read. Fixes #395 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5e39c8c commit 4fd4dc2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/src/integration/tests/test_heartbeat.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,12 @@ CASSANDRA_INTEGRATION_TEST_F(HeartbeatTests, HeartbeatFailed) {
8484
CHECK_FAILURE;
8585

8686
logger_.add_critera("Timed out while waiting for response to keepalive request");
87-
Cluster cluster =
88-
default_cluster().with_connection_heartbeat_interval(1).with_connection_idle_timeout(5);
87+
// Use 1 connection per host to avoid asynchronous shard-aware connection
88+
// establishment that could race with the baseline connection count read.
89+
Cluster cluster = default_cluster()
90+
.with_core_connections_per_host(1)
91+
.with_connection_heartbeat_interval(1)
92+
.with_connection_idle_timeout(5);
8993
connect(cluster);
9094

9195
cass_uint64_t initial_connections = session_.metrics().stats.total_connections;

0 commit comments

Comments
 (0)