mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-01 04:01:20 +00:00
fix(swarm): make test not flaky
In the unlikely event that we generated a random number twice, the 2nd address would not get added. Ensure we loop until we have 20 addresses. Pull-Request: #4030.
This commit is contained in:
parent
1d3db7d9a8
commit
2f8e1489c9
@ -126,7 +126,7 @@ mod tests {
|
||||
fn when_pushing_more_than_max_addresses_oldest_is_evicted() {
|
||||
let mut addresses = ExternalAddresses::default();
|
||||
|
||||
for _ in 0..MAX_LOCAL_EXTERNAL_ADDRS {
|
||||
while addresses.as_slice().len() < MAX_LOCAL_EXTERNAL_ADDRS {
|
||||
let random_address =
|
||||
Multiaddr::empty().with(Protocol::Memory(rand::thread_rng().gen_range(0..1000)));
|
||||
addresses.on_swarm_event(
|
||||
|
Loading…
x
Reference in New Issue
Block a user