Skip to content

Commit

Permalink
chore: rebase on latest
Browse files Browse the repository at this point in the history
Signed-off-by: iGxnon <[email protected]>
  • Loading branch information
iGxnon committed Dec 29, 2023
1 parent 8203b95 commit c184db7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
21 changes: 7 additions & 14 deletions curp/src/client_new/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ use crate::{
members::ServerId,
rpc::{
connect::{ConnectApi, MockConnectApi},
CurpError, FetchClusterResponse, Member, ProposeId, ProposeResponse, WaitSyncedResponse,
CurpError, CurpErrorPriority, FetchClusterResponse, Member, ProposeId, ProposeResponse,
WaitSyncedResponse,
},
};

Expand Down Expand Up @@ -268,10 +269,9 @@ async fn test_unary_fast_round_return_early_err() {
CurpError::node_not_exist(),
CurpError::learner_not_catch_up(),
CurpError::expired_client_id(),
CurpError::wrong_cluster_version(),
CurpError::redirect(Some(1), 0),
] {
assert!(early_err.return_early());
assert_eq!(early_err.priority(), CurpErrorPriority::ReturnImmediately);
// record how many times `handle_propose` was invoked.
let counter = Arc::new(Mutex::new(0));
let connects = init_mocked_connects(3, |_id, conn| {
Expand Down Expand Up @@ -530,10 +530,9 @@ async fn test_unary_propose_return_early_err() {
CurpError::node_not_exist(),
CurpError::learner_not_catch_up(),
CurpError::expired_client_id(),
CurpError::wrong_cluster_version(),
CurpError::redirect(Some(1), 0),
] {
assert!(early_err.return_early());
assert_eq!(early_err.priority(), CurpErrorPriority::ReturnImmediately);
// record how many times rpc was invoked.
let counter = Arc::new(Mutex::new(0));
let connects = init_mocked_connects(5, |id, conn| {
Expand Down Expand Up @@ -576,7 +575,7 @@ async fn test_retry_propose_return_no_retry_error() {
CurpError::learner_not_catch_up(),
] {
// all no retry errors are returned early
assert!(early_err.return_early());
assert_eq!(early_err.priority(), CurpErrorPriority::ReturnImmediately);
// record how many times rpc was invoked.
let counter = Arc::new(Mutex::new(0));
let connects = init_mocked_connects(5, |id, conn| {
Expand All @@ -596,10 +595,7 @@ async fn test_retry_propose_return_no_retry_error() {
});
});
let unary = Unary::<TestCommand>::new(connects, None, Some(0), Some(1));
let retry = Retry::new(
unary,
RetryConfig::new_fixed(Duration::from_millis(100), 5, false),
);
let retry = Retry::new(unary, RetryConfig::new_fixed(Duration::from_millis(100), 5));
let err = retry
.propose(&TestCommand::default(), false)
.await
Expand Down Expand Up @@ -631,10 +627,7 @@ async fn test_retry_propose_return_retry_error() {
}
});
let unary = Unary::<TestCommand>::new(connects, None, Some(0), Some(1));
let retry = Retry::new(
unary,
RetryConfig::new_fixed(Duration::from_millis(10), 5, false),
);
let retry = Retry::new(unary, RetryConfig::new_fixed(Duration::from_millis(10), 5));
let err = retry
.propose(&TestCommand::default(), false)
.await
Expand Down
4 changes: 4 additions & 0 deletions curp/src/rpc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,10 @@ impl PublishRequest {
}
}

/// NOTICE:
/// Please check test case `test_unary_fast_round_return_early_err` `test_unary_propose_return_early_err`
/// `test_retry_propose_return_no_retry_error` `test_retry_propose_return_retry_error` if you added some
/// new [`CurpError`]
impl CurpError {
/// `KeyConflict` error
pub(crate) fn key_conflict() -> Self {
Expand Down

0 comments on commit c184db7

Please sign in to comment.