From 6188022c3526d3c751d715f7edc115a626bb05fd Mon Sep 17 00:00:00 2001 From: teor Date: Tue, 26 Oct 2021 17:03:21 +1000 Subject: [PATCH] Run some network test cases in parallel to speed them up --- .../src/peer_set/initialize/tests/vectors.rs | 43 +++++++++++++++++-- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/zebra-network/src/peer_set/initialize/tests/vectors.rs b/zebra-network/src/peer_set/initialize/tests/vectors.rs index 4b78b9b2c6b..d28dedf4f43 100644 --- a/zebra-network/src/peer_set/initialize/tests/vectors.rs +++ b/zebra-network/src/peer_set/initialize/tests/vectors.rs @@ -58,7 +58,7 @@ const CRAWLER_FAKE_PEER_COUNT: usize = 2; /// /// Note: This test doesn't cover local interface or public IP address discovery. #[tokio::test] -async fn local_listener_unspecified_port_unspecified_addr() { +async fn local_listener_unspecified_port_unspecified_addr_v4() { zebra_test::init(); if zebra_test::net::zebra_skip_network_tests() { @@ -69,6 +69,19 @@ async fn local_listener_unspecified_port_unspecified_addr() { // (localhost should be enough) local_listener_port_with("0.0.0.0:0".parse().unwrap(), Mainnet).await; local_listener_port_with("0.0.0.0:0".parse().unwrap(), Testnet).await; +} + +/// Test that zebra-network discovers dynamic bind-to-all-interfaces listener ports, +/// and sends them to the `AddressBook`. +/// +/// Note: This test doesn't cover local interface or public IP address discovery. +#[tokio::test] +async fn local_listener_unspecified_port_unspecified_addr_v6() { + zebra_test::init(); + + if zebra_test::net::zebra_skip_network_tests() { + return; + } if zebra_test::net::zebra_skip_ipv6_tests() { return; @@ -82,7 +95,7 @@ async fn local_listener_unspecified_port_unspecified_addr() { /// Test that zebra-network discovers dynamic localhost listener ports, /// and sends them to the `AddressBook`. #[tokio::test] -async fn local_listener_unspecified_port_localhost_addr() { +async fn local_listener_unspecified_port_localhost_addr_v4() { zebra_test::init(); if zebra_test::net::zebra_skip_network_tests() { @@ -92,6 +105,17 @@ async fn local_listener_unspecified_port_localhost_addr() { // these tests might fail on machines with unusual IPv4 localhost configs local_listener_port_with("127.0.0.1:0".parse().unwrap(), Mainnet).await; local_listener_port_with("127.0.0.1:0".parse().unwrap(), Testnet).await; +} + +/// Test that zebra-network discovers dynamic localhost listener ports, +/// and sends them to the `AddressBook`. +#[tokio::test] +async fn local_listener_unspecified_port_localhost_addr_v6() { + zebra_test::init(); + + if zebra_test::net::zebra_skip_network_tests() { + return; + } if zebra_test::net::zebra_skip_ipv6_tests() { return; @@ -104,11 +128,10 @@ async fn local_listener_unspecified_port_localhost_addr() { /// Test that zebra-network propagates fixed localhost listener ports to the `AddressBook`. #[tokio::test] -async fn local_listener_fixed_port_localhost_addr() { +async fn local_listener_fixed_port_localhost_addr_v4() { zebra_test::init(); let localhost_v4 = "127.0.0.1".parse().unwrap(); - let localhost_v6 = "::1".parse().unwrap(); if zebra_test::net::zebra_skip_network_tests() { return; @@ -116,6 +139,18 @@ async fn local_listener_fixed_port_localhost_addr() { local_listener_port_with(SocketAddr::new(localhost_v4, random_known_port()), Mainnet).await; local_listener_port_with(SocketAddr::new(localhost_v4, random_known_port()), Testnet).await; +} + +/// Test that zebra-network propagates fixed localhost listener ports to the `AddressBook`. +#[tokio::test] +async fn local_listener_fixed_port_localhost_addr_v6() { + zebra_test::init(); + + let localhost_v6 = "::1".parse().unwrap(); + + if zebra_test::net::zebra_skip_network_tests() { + return; + } if zebra_test::net::zebra_skip_ipv6_tests() { return;