Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: shutdown cluster test timeout #918

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions crates/curp/tests/it/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,26 @@ 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) => {
// Here we suppose that the CurpError::RpcTransport(()) error is
// due to the cluster has been shutted down.
// If we do not break here, it may retry 3 times (10.5s) for all
// 10 nodes, that will cause the test timeout failure.
if err.code() == tonic::Code::DeadlineExceeded
|| matches!(
err.into(),
CurpError::ShuttingDown(_) | CurpError::RpcTransport(())
)
{
return collection;
}
}
}
}
collection
Expand Down
Loading