Skip to content

Commit

Permalink
Updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexei-Kornienko committed Nov 24, 2020
1 parent 7b916ad commit 8b0a499
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/rep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl BlockingRecv for RepSocket {
return Ok(messages.pop().unwrap());
}
Some((_peer_id, _)) => todo!(),
None => todo!(),
None => return Err(ZmqError::NoMessage),
};
}
}
Expand Down
1 change: 1 addition & 0 deletions tests/pub_sub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ async fn test_pub_sub_sockets() {

pub_socket
.send(cloned_payload.clone().into())
.await
.expect("Failed to send");
tokio::time::delay_for(Duration::from_millis(1)).await;
}
Expand Down
6 changes: 4 additions & 2 deletions tests/req_rep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ async fn run_rep_server(mut rep_socket: RepSocket) -> Result<(), Box<dyn Error>>

for i in 0..10i32 {
let mess: String = rep_socket.recv().await?.try_into()?;
rep_socket.send(format!("{} Rep - {}", mess, i).into())?;
rep_socket
.send(format!("{} Rep - {}", mess, i).into())
.await?;
}
// yield for a moment to ensure that server has some time to flush socket
let errs = rep_socket.close().await;
Expand Down Expand Up @@ -73,7 +75,7 @@ async fn test_many_req_rep_sockets() -> Result<(), Box<dyn Error>> {

for _ in 0..10000i32 {
let mess: String = rep_socket.recv().await?.try_into()?;
rep_socket.send(format!("{} Rep", mess).into())?;
rep_socket.send(format!("{} Rep", mess).into()).await?;
}
Ok(())
}

0 comments on commit 8b0a499

Please sign in to comment.