Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

PAN-2404 - Make PeerDiscovertAgentTest less flakey. #1262

Merged
merged 3 commits into from
Apr 11, 2019
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
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ public void neighborsPacketLimited() {

// Start another peer pointing to those 20 agents.
final MockPeerDiscoveryAgent agent = helper.startDiscoveryAgent(otherPeers);
assertThat(agent.getPeers()).hasSize(20);
// We used to do a hasSize match but we had issues with duplicate peers getting added to the
// list. By moving to a contains we make sure that all the peers are loaded with tolerance for
// duplicates. If we fix the duplication problem we should use containsExactlyInAnyOrder to
// hedge against missing one and duplicating another.
assertThat(agent.getPeers()).contains(otherPeers.toArray(new DiscoveryPeer[20]));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be good to add a comment here related to this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

assertThat(agent.getPeers()).allMatch(p -> p.getStatus() == PeerDiscoveryStatus.BONDED);

// Use additional agent to exchange messages with agent
Expand Down