From 5ff6397d0a6e145a15da61deddbf30dc12440ba7 Mon Sep 17 00:00:00 2001 From: Max Inden Date: Thu, 19 Aug 2021 19:01:56 +0200 Subject: [PATCH] core/tests: Adjust to type changes --- core/tests/connection_limits.rs | 6 +++--- core/tests/network_dial_error.rs | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/core/tests/connection_limits.rs b/core/tests/connection_limits.rs index 65e61c4b3c4..471f054caf3 100644 --- a/core/tests/connection_limits.rs +++ b/core/tests/connection_limits.rs @@ -23,7 +23,7 @@ mod util; use futures::{future::poll_fn, ready}; use libp2p_core::multiaddr::{multiaddr, Multiaddr}; use libp2p_core::{ - connection::PendingConnectionError, + connection::ConnectionError, network::{ConnectionLimits, DialError, NetworkConfig, NetworkEvent}, PeerId, }; @@ -111,8 +111,8 @@ fn max_established_incoming() { network1.accept(connection, TestHandler()).unwrap(); } NetworkEvent::ConnectionEstablished { .. } => {} - NetworkEvent::IncomingConnectionError { - error: PendingConnectionError::ConnectionLimit(err), + NetworkEvent::ConnectionClosed { + error: Some(ConnectionError::ConnectionLimit(err)), .. } => { assert_eq!(err.limit, limit); diff --git a/core/tests/network_dial_error.rs b/core/tests/network_dial_error.rs index 224d7950eac..04aba9fb420 100644 --- a/core/tests/network_dial_error.rs +++ b/core/tests/network_dial_error.rs @@ -65,11 +65,12 @@ fn deny_incoming_connec() { match swarm2.poll(cx) { Poll::Ready(NetworkEvent::DialError { - attempts_remaining: 0, + attempts_remaining, peer_id, multiaddr, error: PendingConnectionError::Transport(_), }) => { + assert_eq!(0u32, (&attempts_remaining).into()); assert_eq!(&peer_id, swarm1.local_peer_id()); assert_eq!( multiaddr, @@ -201,10 +202,10 @@ fn multiple_addresses_err() { .with(Protocol::P2p(target.clone().into())); assert_eq!(multiaddr, expected); if addresses.is_empty() { - assert_eq!(attempts_remaining, 0); + assert_eq!(Into::::into(&attempts_remaining), 0); return Poll::Ready(Ok(())); } else { - assert_eq!(attempts_remaining, addresses.len() as u32); + assert_eq!(Into::::into(&attempts_remaining), addresses.len() as u32); } } Poll::Ready(_) => unreachable!(),