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: remove counter to keep aligned with early return in fast path #859

Merged
merged 1 commit into from
Jun 18, 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
8 changes: 1 addition & 7 deletions crates/curp/src/client/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,14 +538,10 @@ async fn test_unary_propose_slow_path_works() {
#[traced_test]
#[tokio::test]
async fn test_unary_propose_fast_path_fallback_slow_path() {
// record how many times `handle_propose` was invoked.
let counter = Arc::new(Mutex::new(0));
let connects = init_mocked_connects(5, |id, conn| {
let counter_c = Arc::clone(&counter);
conn.expect_propose()
.return_once(move |_req, _token, _timeout| {
counter_c.lock().unwrap().add_assign(1);
// insufficient quorum
// insufficient quorum to force slow path.
let resp = match id {
0 => ProposeResponse::new_result::<TestCommand>(&Ok(
TestCommandResult::default(),
Expand Down Expand Up @@ -579,8 +575,6 @@ async fn test_unary_propose_fast_path_fallback_slow_path() {
start_at.elapsed() > Duration::from_millis(100),
"slow round takes at least 100ms"
);
// indicate that we actually run out of fast round
assert_eq!(*counter.lock().unwrap(), 5);
assert_eq!(
res,
(TestCommandResult::default(), Some(LogIndexResult::from(1)))
Expand Down
Loading