Skip to content

Commit

Permalink
Fix test to sort peer ids into deterministic order
Browse files Browse the repository at this point in the history
  • Loading branch information
rklaehn committed Aug 7, 2020
1 parent 8b8632b commit fcfbbec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion protocols/gossipsub/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 0.21.0 [unreleased]

- public API to list topics and peers. [PR 1677](https://github.com/libp2p/rust-libp2p/pull/1677).
- Add public API to list topics and peers. [PR 1677](https://github.com/libp2p/rust-libp2p/pull/1677).

- `Debug` instance for `Gossipsub`. [PR 1673](https://github.com/libp2p/rust-libp2p/pull/1673).

Expand Down
5 changes: 3 additions & 2 deletions protocols/gossipsub/src/behaviour/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -901,19 +901,20 @@ mod tests {
fn test_public_api() {
let (gs, peers, topic_hashes) =
build_and_inject_nodes(4, vec![String::from("topic1")], true);
let peers = peers.into_iter().collect::<BTreeSet<_>>();

assert_eq!(
gs.topics().cloned().collect::<Vec<_>>(), topic_hashes,
"Expected topics to match registered topic."
);

assert_eq!(
gs.peers(&TopicHash::from_raw("topic1")).cloned().collect::<Vec<_>>(), peers,
gs.peers(&TopicHash::from_raw("topic1")).cloned().collect::<BTreeSet<_>>(), peers,
"Expected peers for a registered topic to contain all peers."
);

assert_eq!(
gs.all_peers().cloned().collect::<BTreeSet<_>>(), peers.into_iter().collect::<BTreeSet<_>>(),
gs.all_peers().cloned().collect::<BTreeSet<_>>(), peers,
"Expected all_peers to contain all peers."
);
}
Expand Down

0 comments on commit fcfbbec

Please sign in to comment.