patches flaky gossip pull from entrypoint test (#25589)

test_pull_from_entrypoint_if_not_present relies on a deterministic
ordering for the entries when generating gossip pull requests.

https://github.com/solana-labs/solana/pull/25460
changed an intermediate type for gossip pull-requests from Vec to
HashMap, and so the entries are no longer deterministically ordered.
This causes the test to be flaky.

The commit updates the test so that it no longer relies on the ordering.
This commit is contained in:
behzad nouri 2022-05-26 18:58:06 +00:00 committed by GitHub
parent 41988807d3
commit 69cbbaf483
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 9 deletions

View File

@ -4083,15 +4083,15 @@ mod tests {
let (pings, pulls) = cluster_info.new_pull_requests(&thread_pool, None, &stakes);
assert!(pings.is_empty());
assert_eq!(pulls.len(), 2 * MIN_NUM_BLOOM_FILTERS);
assert!(pulls
.iter()
.take(MIN_NUM_BLOOM_FILTERS)
.all(|(addr, _)| *addr == other_node.gossip));
assert!(pulls
.iter()
.skip(MIN_NUM_BLOOM_FILTERS)
.all(|(addr, _)| *addr == entrypoint.gossip));
for node in [&other_node, &entrypoint] {
assert_eq!(
pulls
.iter()
.filter(|(addr, _)| *addr == node.gossip)
.count(),
MIN_NUM_BLOOM_FILTERS
);
}
// Pull request 3: `other_node` is present and `entrypoint` was just pulled from. There should
// only be one pull request to `other_node`
let (pings, pulls) = cluster_info.new_pull_requests(&thread_pool, None, &stakes);