patches flaky test_new_mark_creation_time (#17288) (#17336)

(cherry picked from commit f7b0184f81)

Co-authored-by: behzad nouri <behzadnouri@gmail.com>
This commit is contained in:
mergify[bot]
2021-05-19 22:22:24 +00:00
committed by GitHub
parent c4e770e2f8
commit dc0b21fa83

View File

@ -1048,22 +1048,28 @@ mod test {
let now = now + 1_000; let now = now + 1_000;
let mut pings = Vec::new(); let mut pings = Vec::new();
let ping_cache = Mutex::new(ping_cache); let ping_cache = Mutex::new(ping_cache);
for _ in 0..10 { let old = old.contact_info().unwrap();
let req = node.new_pull_request( let count = repeat_with(|| {
&thread_pool, let (peer, _filters) = node
&crds, .new_pull_request(
&node_keypair, &thread_pool,
0, &crds,
now, &node_keypair,
None, 0, // self_shred_version
&HashMap::new(), now,
PACKET_DATA_SIZE, None, // gossip_validators
&ping_cache, &HashMap::new(), // stakes
&mut pings, PACKET_DATA_SIZE, // bloom_size
); &ping_cache,
let (peer, _) = req.unwrap(); &mut pings,
assert_eq!(peer, *old.contact_info().unwrap()); )
} .unwrap();
peer
})
.take(100)
.filter(|peer| peer != old)
.count();
assert!(count < 2, "count of peer != old: {}", count);
} }
#[test] #[test]