Skip to content

Commit

Permalink
update test to search a few for ping instead of first due to resp3 ch…
Browse files Browse the repository at this point in the history
…anges
  • Loading branch information
genusistimelord committed Dec 21, 2023
1 parent bb232e7 commit b3ed769
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions tests/pubsub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,27 @@ pub async fn test_monitor() {
.await
.unwrap();

let monitor = rx.on_message::<String>().next().await.unwrap();
let monitor = monitor.split(" ").collect::<Vec<_>>();
let mut i = 0;
let mut was_ping = false;

assert_eq!("\"PING\"", monitor[3]);
assert_eq!("\"test\"", monitor[4]);
while let Some(string) = rx.on_message::<String>().next().await {
let monitor = string.split(" ").collect::<Vec<_>>();
if "\"PING\"" == monitor[3] {
was_ping = true;
break;
}

let _: () = redis::cmd("PING")
.arg("test")
.query_async(&mut tx)
.await
.unwrap();
i += 1;

if i > 3 {
break;
}
}

assert_eq!(true, was_ping);
}

0 comments on commit b3ed769

Please sign in to comment.