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

fix failing node-table tests on mac os #9633

Merged
merged 1 commit into from
Sep 24, 2018
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
22 changes: 16 additions & 6 deletions util/network-devp2p/src/node_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -624,19 +624,29 @@ mod tests {

// unknown - node 6

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

assert_eq!(r[0][..], id4[..]); // most recent success
assert_eq!(r[1][..], id3[..]);
// most recent success
assert!(
(r[0] == id4 && r[1] == id3) ||
(r[0] == id3 && r[1] == id4)
);

// unknown (old contacts and new nodes), randomly shuffled
assert!(
r[2][..] == id5[..] && r[3][..] == id6[..] ||
r[2][..] == id6[..] && r[3][..] == id5[..]
(r[2] == id5 && r[3] == id6) ||
(r[2] == id6 && r[3] == id5)
);

assert_eq!(r[4][..], id1[..]); // oldest failure
assert_eq!(r[5][..], id2[..]);
// oldest failure
assert!(
(r[4] == id1 && r[5] == id2) ||
(r[4] == id2 && r[5] == id1)
);
}

#[test]
Expand Down