Skip to content

Commit 7d60c11

Browse files
committed
make test_raw_node_propose_and_conf_change insensitive to node order
Signed-off-by: Guillaume Girol <guillaume.girol@rubycat.eu>
1 parent 4b86aed commit 7d60c11

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

harness/tests/integration_cases/test_raw_node.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ fn test_raw_node_propose_and_conf_change() {
250250
let cs = conf_state_v2(vec![2], vec![3], vec![1], vec![1], true);
251251
test_cases.push((Box::new(cc), cs, Some(conf_state(vec![2], vec![1, 3]))));
252252

253-
for (cc, exp, exp2) in test_cases {
253+
for (cc, mut exp, exp2) in test_cases {
254254
let s = new_storage();
255255
let mut raw_node = new_raw_node(1, vec![1], 10, 1, s.clone(), &l);
256256
raw_node.campaign().unwrap();
@@ -320,7 +320,10 @@ fn test_raw_node_propose_and_conf_change() {
320320
assert_eq!(entries[1].get_entry_type(), EntryType::EntryConfChangeV2);
321321
}
322322
assert_eq!(ccdata, entries[1].get_data());
323-
assert_eq!(exp, cs.unwrap());
323+
let mut cs = cs.unwrap();
324+
exp.voters.sort();
325+
cs.voters.sort();
326+
assert_eq!(exp, cs);
324327

325328
let conf_index = if cc.as_v2().enter_joint() == Some(true) {
326329
// If this is an auto-leaving joint conf change, it will have
@@ -365,8 +368,11 @@ fn test_raw_node_propose_and_conf_change() {
365368
assert_eq!(context, leave_cc.get_context(), "{:?}", cc.as_v2());
366369
// Lie and pretend the ConfChange applied. It won't do so because now
367370
// we require the joint quorum and we're only running one node.
368-
let cs = raw_node.apply_conf_change(&leave_cc).unwrap();
369-
assert_eq!(cs, exp2.unwrap());
371+
let mut cs = raw_node.apply_conf_change(&leave_cc).unwrap();
372+
cs.learners.sort();
373+
let mut exp2 = exp2.unwrap();
374+
exp2.learners.sort();
375+
assert_eq!(cs, exp2);
370376
}
371377
}
372378

0 commit comments

Comments
 (0)