Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
barshaul committed Aug 15, 2024
1 parent 6e4a94f commit 7e8c31c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
6 changes: 3 additions & 3 deletions redis/tests/test_cluster_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2400,7 +2400,7 @@ mod cluster_async {
.block_on(cmd.query_async::<_, Vec<String>>(&mut connection))
.unwrap_err();
assert!(
matches!(result.kind(), ErrorKind::ClusterConnectionNotFound)
matches!(result.kind(), ErrorKind::ConnectionNotFoundForRoute)
|| result.is_connection_dropped()
);
}
Expand Down Expand Up @@ -4031,7 +4031,7 @@ mod cluster_async {
handler: _handler,
..
} = MockEnv::with_client_builder(
ClusterClient::builder(vec![&*format!("redis://{name}")]),
ClusterClient::builder(vec![&*format!("redis://{name}")]).retries(1),
name,
move |received_cmd: &[u8], _| {
let slots_config_vec = vec![
Expand Down Expand Up @@ -4071,7 +4071,7 @@ mod cluster_async {
let res_err = res.unwrap_err();
assert_eq!(
res_err.kind(),
ErrorKind::ClusterConnectionNotFound,
ErrorKind::ConnectionNotFoundForRoute,
"{:?}",
res_err
);
Expand Down
26 changes: 22 additions & 4 deletions redis/tests/test_cluster_scan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,12 @@ mod test_cluster_scan_async {

#[tokio::test] // test cluster scan with node fail in the middle
async fn test_async_cluster_scan_with_fail() {
let cluster = TestClusterContext::new(3, 0);
let cluster = TestClusterContext::new_with_cluster_client_builder(
3,
0,
|builder| builder.retries(1),
false,
);
let mut connection = cluster.async_connection(None).await;
// Set some keys
for i in 0..1000 {
Expand Down Expand Up @@ -224,7 +229,11 @@ mod test_cluster_scan_async {
let cluster = TestClusterContext::new_with_cluster_client_builder(
6,
1,
|builder| builder.slots_refresh_rate_limit(Duration::from_secs(0), 0),
|builder| {
builder
.slots_refresh_rate_limit(Duration::from_secs(0), 0)
.retries(1)
},
false,
);

Expand Down Expand Up @@ -374,7 +383,11 @@ mod test_cluster_scan_async {
let cluster = TestClusterContext::new_with_cluster_client_builder(
6,
1,
|builder| builder.slots_refresh_rate_limit(Duration::from_secs(0), 0),
|builder| {
builder
.slots_refresh_rate_limit(Duration::from_secs(0), 0)
.retries(1)
},
false,
);

Expand Down Expand Up @@ -772,7 +785,12 @@ mod test_cluster_scan_async {
// Testing cluster scan when connection fails in the middle and we get an error
// then cluster up again and scanning can continue without any problem
async fn test_async_cluster_scan_failover() {
let mut cluster = TestClusterContext::new(3, 0);
let mut cluster = TestClusterContext::new_with_cluster_client_builder(
3,
0,
|builder| builder.retries(1),
false,
);
let mut connection = cluster.async_connection(None).await;
let mut i = 0;
loop {
Expand Down

0 comments on commit 7e8c31c

Please sign in to comment.