Fix flaky new_archiver_external_ip_test (#9457)

automerge
This commit is contained in:
Michael Vines 2020-04-12 11:49:34 -07:00 committed by GitHub
parent 3f1399cb0d
commit 8cda974552
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 5 deletions

View File

@ -2014,20 +2014,23 @@ mod tests {
#[test] #[test]
fn new_archiver_external_ip_test() { fn new_archiver_external_ip_test() {
// Can't use VALIDATOR_PORT_RANGE because if this test runs in parallel with others, the
// port returned by `bind_in_range()` might be snatched up before `Node::new_with_external_ip()` runs
let port_range = (VALIDATOR_PORT_RANGE.1 + 20, VALIDATOR_PORT_RANGE.1 + 30);
let ip = Ipv4Addr::from(0); let ip = Ipv4Addr::from(0);
let node = Node::new_archiver_with_external_ip( let node = Node::new_archiver_with_external_ip(
&Pubkey::new_rand(), &Pubkey::new_rand(),
&socketaddr!(ip, 0), &socketaddr!(ip, 0),
VALIDATOR_PORT_RANGE, port_range,
IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)),
); );
let ip = IpAddr::V4(ip); let ip = IpAddr::V4(ip);
check_socket(&node.sockets.storage.unwrap(), ip, VALIDATOR_PORT_RANGE); check_socket(&node.sockets.storage.unwrap(), ip, port_range);
check_socket(&node.sockets.gossip, ip, VALIDATOR_PORT_RANGE); check_socket(&node.sockets.gossip, ip, port_range);
check_socket(&node.sockets.repair, ip, VALIDATOR_PORT_RANGE); check_socket(&node.sockets.repair, ip, port_range);
check_sockets(&node.sockets.tvu, ip, VALIDATOR_PORT_RANGE); check_sockets(&node.sockets.tvu, ip, port_range);
} }
//test that all cluster_info objects only generate signed messages //test that all cluster_info objects only generate signed messages