From f7b0184f810879fbff25fcfa137ff81e96bae272 Mon Sep 17 00:00:00 2001 From: behzad nouri Date: Tue, 18 May 2021 13:39:35 +0000 Subject: [PATCH] patches flaky test_new_mark_creation_time (#17288) --- core/src/crds_gossip_pull.rs | 38 +++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/core/src/crds_gossip_pull.rs b/core/src/crds_gossip_pull.rs index add744f043..d74eceaada 100644 --- a/core/src/crds_gossip_pull.rs +++ b/core/src/crds_gossip_pull.rs @@ -1048,22 +1048,28 @@ mod test { let now = now + 1_000; let mut pings = Vec::new(); let ping_cache = Mutex::new(ping_cache); - for _ in 0..10 { - let req = node.new_pull_request( - &thread_pool, - &crds, - &node_keypair, - 0, - now, - None, - &HashMap::new(), - PACKET_DATA_SIZE, - &ping_cache, - &mut pings, - ); - let (peer, _) = req.unwrap(); - assert_eq!(peer, *old.contact_info().unwrap()); - } + let old = old.contact_info().unwrap(); + let count = repeat_with(|| { + let (peer, _filters) = node + .new_pull_request( + &thread_pool, + &crds, + &node_keypair, + 0, // self_shred_version + now, + None, // gossip_validators + &HashMap::new(), // stakes + PACKET_DATA_SIZE, // bloom_size + &ping_cache, + &mut pings, + ) + .unwrap(); + peer + }) + .take(100) + .filter(|peer| peer != old) + .count(); + assert!(count < 2, "count of peer != old: {}", count); } #[test]