Skip to content

Commit

Permalink
added blocking commands tests
Browse files Browse the repository at this point in the history
  • Loading branch information
avifenesh committed Jul 7, 2024
1 parent 4571c91 commit 30350e6
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions redis/tests/test_cluster_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3757,6 +3757,33 @@ mod cluster_async {
.unwrap();
}

#[test]
fn test_async_cluster_blocking_command_when_cluster_drops() {
let cluster = TestClusterContext::new_with_cluster_client_builder(
3,
0,
|builder| builder.retries(3),
false,
);
block_on_all(async move {
let mut connection = cluster.async_connection(None).await;
futures::future::join(
async {
let res = connection.blpop::<&str, f64>("foo", 0.0).await;
assert!(res.is_err());
println!("blpop returned error {:?}", res.map_err(|e| e.to_string()));
},
async {
let _ = sleep(futures_time::time::Duration::from_secs(3)).await;
drop(cluster);
},
)
.await;
Ok::<_, RedisError>(())
})
.unwrap();
}

#[test]
fn test_async_cluster_saves_reconnected_connection() {
let name = "test_async_cluster_saves_reconnected_connection";
Expand Down

0 comments on commit 30350e6

Please sign in to comment.