Skip to content

Commit

Permalink
fix: shutdown cluster test timeout
Browse files Browse the repository at this point in the history
Signed-off-by: lxl66566 <lxl66566@gmail.com>
  • Loading branch information
lxl66566 committed Sep 20, 2024
1 parent 689663d commit 527a3c9
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions crates/curp/tests/it/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,23 @@ async fn shutdown_rpc_should_shutdown_the_cluster() {
for i in 0..10 {
let cmd = TestCommand::new_put(vec![i], i);
let res = req_client.propose(&cmd, None, true).await;
if res.is_ok() && res.unwrap().is_ok() {
collection.push(i);
match res {
Ok(res) => {
if res.is_ok() {
collection.push(i);
}
}
Err(err) => {
// retry 3 times after 10.5s, the cluster has been shutted down
if err.code() == tonic::Code::DeadlineExceeded
|| matches!(
err.into(),
CurpError::ShuttingDown(_) | CurpError::RpcTransport(())
)
{
return collection;
}
}
}
}
collection
Expand Down

0 comments on commit 527a3c9

Please sign in to comment.