Skip to content

Commit

Permalink
Use free ports for cluster tests.
Browse files Browse the repository at this point in the history
This ensures that the cluster tests won't compete with each other for the same ports.
  • Loading branch information
nihohit authored and barshaul committed Jun 26, 2024
1 parent 5e8e532 commit 5c47d9b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion redis/tests/support/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ impl TestContext {
let millisecond = Duration::from_millis(1);
let mut retries = 0;
loop {
match client.get_connection() {
match client.get_connection(None) {
Err(err) => {
if err.is_connection_refusal() {
sleep(millisecond);
Expand Down
11 changes: 7 additions & 4 deletions redis/tests/test_cluster_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3514,10 +3514,13 @@ mod cluster_async {
drop(cluster);

// recreate cluster
let _cluster = RedisCluster::new(RedisClusterConfiguration {
ports: ports.clone(),
..Default::default()
});
let _cluster = TestClusterContext::new_with_config_and_builder(
RedisClusterConfiguration {
ports: ports.clone(),
..Default::default()
},
|builder| builder.retries(2),
);

let cmd = cmd("PING");
// explicitly route to all primaries and request all succeeded
Expand Down

0 comments on commit 5c47d9b

Please sign in to comment.