Skip to content

Commit

Permalink
core/tests: Adjust to type changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mxinden committed Aug 19, 2021
1 parent 425e777 commit 5ff6397
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions core/tests/connection_limits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -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);
Expand Down
7 changes: 4 additions & 3 deletions core/tests/network_dial_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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::<u32>::into(&attempts_remaining), 0);
return Poll::Ready(Ok(()));
} else {
assert_eq!(attempts_remaining, addresses.len() as u32);
assert_eq!(Into::<u32>::into(&attempts_remaining), addresses.len() as u32);
}
}
Poll::Ready(_) => unreachable!(),
Expand Down

0 comments on commit 5ff6397

Please sign in to comment.