Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.

Commit f1831e0

Browse files
committed
fix failing node-table tests on mac os, closes #9632
1 parent adcbfcf commit f1831e0

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

util/network-devp2p/src/node_table.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -624,19 +624,29 @@ mod tests {
624624

625625
// unknown - node 6
626626

627+
// nodes are also ordered according to their addition time
628+
//
629+
// nanosecond precision lost since mac os x high sierra update so let's not compare their order
630+
// https://github.com/paritytech/parity-ethereum/issues/9632
627631
let r = table.nodes(&IpFilter::default());
628632

629-
assert_eq!(r[0][..], id4[..]); // most recent success
630-
assert_eq!(r[1][..], id3[..]);
633+
// most recent success
634+
assert!(
635+
(r[0] == id4 && r[1] == id3) ||
636+
(r[0] == id3 && r[1] == id4)
637+
);
631638

632639
// unknown (old contacts and new nodes), randomly shuffled
633640
assert!(
634-
r[2][..] == id5[..] && r[3][..] == id6[..] ||
635-
r[2][..] == id6[..] && r[3][..] == id5[..]
641+
(r[2] == id5 && r[3] == id6) ||
642+
(r[2] == id6 && r[3] == id5)
636643
);
637644

638-
assert_eq!(r[4][..], id1[..]); // oldest failure
639-
assert_eq!(r[5][..], id2[..]);
645+
// oldest failure
646+
assert!(
647+
(r[4] == id1 && r[5] == id2) ||
648+
(r[4] == id2 && r[5] == id1)
649+
);
640650
}
641651

642652
#[test]

0 commit comments

Comments
 (0)