Skip to content

Commit 8d3592c

Browse files
committed
test: add truncate before append in log test to prevent conflict
Add `truncate_after()` call before appending entries in the log terms test to avoid conflict errors that may occur due to store implementation. Changes: - Add `truncate_after()` before `append()` in log terms test case
1 parent a90c841 commit 8d3592c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

openraft/src/testing/log/suite.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,9 @@ where
674674

675675
tracing::info!("--- log terms: [0,1,1,2], last_purged_log_id is None, expect [(0,0),(1,1),(2,3)]");
676676
{
677+
// truncate for new append, otherwise there may be conflict error, due to impl of the store.
678+
store.truncate_after(Some(log_id(0, 0, 0))).await?;
679+
677680
append(&mut store, [
678681
blank_ent_0::<C>(1, 1),
679682
blank_ent_0::<C>(1, 2),

0 commit comments

Comments
 (0)