Skip to content

Commit

Permalink
Test if probably unreachable peers are ignored
Browse files Browse the repository at this point in the history
Given an `AddressBook` with a list of arbitrary `MetaAddr`s, check that
none of the peers listed for a reconnection is probably unreachable.
  • Loading branch information
jvff committed Nov 5, 2021
1 parent 1d05ef0 commit d037afc
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions zebra-network/src/address_book/tests/prop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,19 @@ proptest! {
prop_assert!(duration_since_last_seen <= MAX_PEER_ACTIVE_FOR_GOSSIP);
}
}

/// Test if peers that are probably unreachable are not listed for a reconnection attempt.
#[test]
fn probably_unreachable_addresses_are_not_attempted(
local_listener in any::<SocketAddr>(),
addresses in vec(any::<MetaAddr>(), 0..MAX_META_ADDR),
) {
zebra_test::init();

let address_book = AddressBook::new_with_addrs(local_listener, Span::none(), addresses);

for peer in address_book.reconnection_peers() {
prop_assert!(!peer.is_probably_unreachable());
}
}
}

0 comments on commit d037afc

Please sign in to comment.