From 32ea0cada7843736aa376da0c7bf9d9f24fcb58e Mon Sep 17 00:00:00 2001 From: Alexandru Vasile Date: Mon, 18 Mar 2024 18:29:13 +0200 Subject: [PATCH] tests: Switch to ipv4 localhost Signed-off-by: Alexandru Vasile --- src/transport/tcp/connection.rs | 24 ++++++++++++------------ tests/connection/mod.rs | 6 +++--- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/transport/tcp/connection.rs b/src/transport/tcp/connection.rs index 50fc0550..8ec315e4 100644 --- a/src/transport/tcp/connection.rs +++ b/src/transport/tcp/connection.rs @@ -667,7 +667,7 @@ mod tests { .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) .try_init(); - let listener = TcpListener::bind("[::1]:0").await.unwrap(); + let listener = TcpListener::bind("127.0.0.1:0").await.unwrap(); let address = listener.local_addr().unwrap(); tokio::spawn(async move { @@ -715,7 +715,7 @@ mod tests { .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) .try_init(); - let listener = TcpListener::bind("[::1]:0").await.unwrap(); + let listener = TcpListener::bind("127.0.0.1:0").await.unwrap(); let address = listener.local_addr().unwrap(); let (Ok(mut dialer), Ok((stream, dialer_address))) = @@ -757,7 +757,7 @@ mod tests { .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) .try_init(); - let listener = TcpListener::bind("[::1]:0").await.unwrap(); + let listener = TcpListener::bind("127.0.0.1:0").await.unwrap(); let address = listener.local_addr().unwrap(); tokio::spawn(async move { @@ -807,7 +807,7 @@ mod tests { .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) .try_init(); - let listener = TcpListener::bind("[::1]:0").await.unwrap(); + let listener = TcpListener::bind("127.0.0.1:0").await.unwrap(); let address = listener.local_addr().unwrap(); let (Ok(dialer), Ok((listener, dialer_address))) = @@ -851,7 +851,7 @@ mod tests { .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) .try_init(); - let listener = TcpListener::bind("[::1]:0").await.unwrap(); + let listener = TcpListener::bind("127.0.0.1:0").await.unwrap(); let address = listener.local_addr().unwrap(); let (Ok(dialer), Ok((listener, dialer_address))) = @@ -896,7 +896,7 @@ mod tests { .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) .try_init(); - let listener = TcpListener::bind("[::1]:0").await.unwrap(); + let listener = TcpListener::bind("127.0.0.1:0").await.unwrap(); let address = listener.local_addr().unwrap(); tokio::spawn(async move { @@ -946,7 +946,7 @@ mod tests { .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) .try_init(); - let listener = TcpListener::bind("[::1]:0").await.unwrap(); + let listener = TcpListener::bind("127.0.0.1:0").await.unwrap(); let address = listener.local_addr().unwrap(); tokio::spawn(async move { @@ -991,7 +991,7 @@ mod tests { .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) .try_init(); - let listener = TcpListener::bind("[::1]:0").await.unwrap(); + let listener = TcpListener::bind("127.0.0.1:0").await.unwrap(); let address = listener.local_addr().unwrap(); let (Ok(_dialer), Ok((listener, dialer_address))) = @@ -1031,7 +1031,7 @@ mod tests { .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) .try_init(); - let listener = TcpListener::bind("[::1]:0").await.unwrap(); + let listener = TcpListener::bind("127.0.0.1:0").await.unwrap(); let address = listener.local_addr().unwrap(); let (Ok(dialer), Ok((listener, dialer_address))) = @@ -1088,7 +1088,7 @@ mod tests { .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) .try_init(); - let listener = TcpListener::bind("[::1]:0").await.unwrap(); + let listener = TcpListener::bind("127.0.0.1:0").await.unwrap(); let address = listener.local_addr().unwrap(); tokio::spawn(async move { @@ -1147,7 +1147,7 @@ mod tests { .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) .try_init(); - let listener = TcpListener::bind("[::1]:0").await.unwrap(); + let listener = TcpListener::bind("127.0.0.1:0").await.unwrap(); let address = listener.local_addr().unwrap(); let (Ok(dialer), Ok((listener, dialer_address))) = @@ -1198,7 +1198,7 @@ mod tests { .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) .try_init(); - let listener = TcpListener::bind("[::1]:0").await.unwrap(); + let listener = TcpListener::bind("127.0.0.1:0").await.unwrap(); let address = listener.local_addr().unwrap(); tokio::spawn(async move { diff --git a/tests/connection/mod.rs b/tests/connection/mod.rs index 6699706b..407d1349 100644 --- a/tests/connection/mod.rs +++ b/tests/connection/mod.rs @@ -297,7 +297,7 @@ async fn connect_over_dns() { #[tokio::test] async fn connection_timeout_tcp() { // create tcp listener but don't accept any inbound connections - let listener = TcpListener::bind("[::1]:0").await.unwrap(); + let listener = TcpListener::bind("127.0.0.1:0").await.unwrap(); let address = listener.local_addr().unwrap(); let address = Multiaddr::empty() .with(Protocol::from(address.ip())) @@ -1065,7 +1065,7 @@ async fn port_in_use_tcp() { .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) .try_init(); - let listener = TcpListener::bind("[::1]:0").await.unwrap(); + let listener = TcpListener::bind("127.0.0.1:0").await.unwrap(); let address = listener.local_addr().unwrap(); let _litep2p = Litep2p::new( @@ -1087,7 +1087,7 @@ async fn port_in_use_websocket() { .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) .try_init(); - let listener = TcpListener::bind("[::1]:0").await.unwrap(); + let listener = TcpListener::bind("127.0.0.1:0").await.unwrap(); let address = listener.local_addr().unwrap(); let _litep2p = Litep2p::new(