Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run some network test cases in parallel to speed them up #2960

Merged
merged 2 commits into from
Oct 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 39 additions & 4 deletions zebra-network/src/peer_set/initialize/tests/vectors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const CRAWLER_TEST_DURATION: Duration = Duration::from_secs(10);
///
/// 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() {
Expand All @@ -67,6 +67,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;
Expand All @@ -80,7 +93,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() {
Expand All @@ -90,6 +103,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;
Expand All @@ -102,18 +126,29 @@ 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;
}

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;
Expand Down