From 62ec4828ca9ea7a293b57cec0b11d697f39eed72 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Mon, 22 May 2023 20:20:32 +0200 Subject: [PATCH] Delete tests --- protocols/autonat/tests/test_server.rs | 105 ------------------------- 1 file changed, 105 deletions(-) diff --git a/protocols/autonat/tests/test_server.rs b/protocols/autonat/tests/test_server.rs index 7d3ead0c0c4..f8bcd375c36 100644 --- a/protocols/autonat/tests/test_server.rs +++ b/protocols/autonat/tests/test_server.rs @@ -23,7 +23,6 @@ use libp2p_autonat::{ }; use libp2p_core::{multiaddr::Protocol, ConnectedPoint, Endpoint, Multiaddr}; use libp2p_identity::PeerId; -use libp2p_swarm::DialError; use libp2p_swarm::{Swarm, SwarmEvent}; use libp2p_swarm_test::SwarmExt as _; use std::{num::NonZeroU32, time::Duration}; @@ -127,51 +126,6 @@ async fn test_dial_back() { } } -#[async_std::test] -async fn test_dial_error() { - let (mut server, server_id, server_addr) = new_server_swarm(None).await; - let (mut client, client_id) = new_client_swarm(server_id, server_addr).await; - client.add_external_address("/ip4/127.0.0.1/tcp/12345".parse().unwrap()); - async_std::task::spawn(client.loop_on_next()); - - let request_probe_id = match server.next_behaviour_event().await { - Event::InboundProbe(InboundProbeEvent::Request { peer, probe_id, .. }) => { - assert_eq!(peer, client_id); - probe_id - } - other => panic!("Unexpected behaviour event: {other:?}."), - }; - - loop { - match server.next_swarm_event().await { - SwarmEvent::OutgoingConnectionError { peer_id, error, .. } => { - assert_eq!(peer_id.unwrap(), client_id); - assert!(matches!(error, DialError::Transport(_))); - break; - } - SwarmEvent::Dialing { - peer_id: Some(peer), - .. - } => assert_eq!(peer, client_id), - SwarmEvent::NewListenAddr { .. } | SwarmEvent::ExpiredListenAddr { .. } => {} - other => panic!("Unexpected swarm event: {other:?}."), - } - } - - match server.next_behaviour_event().await { - Event::InboundProbe(InboundProbeEvent::Error { - probe_id, - peer, - error, - }) => { - assert_eq!(probe_id, request_probe_id); - assert_eq!(peer, client_id); - assert_eq!(error, InboundProbeError::Response(ResponseError::DialError)); - } - other => panic!("Unexpected behaviour event: {other:?}."), - } -} - #[async_std::test] async fn test_throttle_global_max() { let (mut server, server_id, server_addr) = new_server_swarm(Some(Config { @@ -259,65 +213,6 @@ async fn test_throttle_peer_max() { }; } -#[async_std::test] -async fn test_dial_multiple_addr() { - let (mut server, server_id, server_addr) = new_server_swarm(Some(Config { - throttle_clients_peer_max: 1, - throttle_clients_period: Duration::from_secs(60), - only_global_ips: false, - ..Default::default() - })) - .await; - - let (mut client, client_id) = new_client_swarm(server_id, server_addr.clone()).await; - client.listen().await; - client.add_external_address("/ip4/127.0.0.1/tcp/12345".parse().unwrap()); - async_std::task::spawn(client.loop_on_next()); - - let dial_addresses = match server.next_behaviour_event().await { - Event::InboundProbe(InboundProbeEvent::Request { - peer, addresses, .. - }) => { - assert_eq!(addresses.len(), 2); - assert_eq!(client_id, peer); - addresses - } - other => panic!("Unexpected behaviour event: {other:?}."), - }; - - loop { - match server.next_swarm_event().await { - SwarmEvent::ConnectionEstablished { - peer_id, - endpoint: - ConnectedPoint::Dialer { - address, - role_override: Endpoint::Dialer, - }, - concurrent_dial_errors, - .. - } => { - assert_eq!(peer_id, client_id); - let dial_errors = concurrent_dial_errors.unwrap(); - - // The concurrent dial might not be fast enough to produce a dial error. - if let Some((addr, _)) = dial_errors.get(0) { - assert_eq!(addr, &dial_addresses[0]); - } - - assert_eq!(address, dial_addresses[1]); - break; - } - SwarmEvent::Dialing { - peer_id: Some(peer), - .. - } => assert_eq!(peer, client_id), - SwarmEvent::NewListenAddr { .. } | SwarmEvent::ExpiredListenAddr { .. } => {} - other => panic!("Unexpected swarm event: {other:?}."), - } - } -} - #[async_std::test] async fn test_global_ips_config() { let (mut server, server_id, server_addr) = new_server_swarm(Some(Config {