Skip to content

Commit

Permalink
Chore: make case append_to_log more rigorous
Browse files Browse the repository at this point in the history
In case append_to_log, two entries with index = 10 were appended to
log, it will fail if we choose stream-like log store instead of
map-like, and it will never happen in real world.
  • Loading branch information
pfwang80s committed Nov 25, 2023
1 parent f5d7e54 commit 97d8c21
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions openraft/src/testing/suite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -936,13 +936,13 @@ where

store.purge(log_id_0(0, 0)).await?;

append(&mut store, [blank_ent_0::<C>(2, 10)]).await?;
append(&mut store, [blank_ent_0::<C>(2, 11)]).await?;

let l = store.try_get_log_entries(0..).await?.len();
let last = store.try_get_log_entries(0..).await?.into_iter().last().unwrap();

assert_eq!(l, 10, "expected 10 entries to exist in the log");
assert_eq!(*last.get_log_id(), log_id_0(2, 10), "unexpected log id");
assert_eq!(l, 11, "expected 11 entries to exist in the log");
assert_eq!(*last.get_log_id(), log_id_0(2, 11), "unexpected log id");
Ok(())
}

Expand Down

0 comments on commit 97d8c21

Please sign in to comment.