Skip to content

Fix connection_timeout_rpc_notified test (p2p) #1131

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

Merged
merged 4 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
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
15 changes: 9 additions & 6 deletions p2p/src/peer_manager/tests/connections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ use crate::{
protocol::NETWORK_PROTOCOL_CURRENT,
testing_utils::{
connect_and_accept_services, connect_services, get_connectivity_event,
peerdb_inmemory_store, test_p2p_config, RandomAddressMaker, TestTcpAddressMaker,
TestTransportChannel, TestTransportMaker, TestTransportNoise, TestTransportTcp,
peerdb_inmemory_store, test_p2p_config, TestTransportChannel, TestTransportMaker,
TestTransportNoise, TestTransportTcp,
},
types::peer_id::PeerId,
utils::oneshot_nofail,
Expand Down Expand Up @@ -679,18 +679,21 @@ async fn connection_timeout_rpc_notified<T>(
))
.unwrap();

match timeout(*p2p_config.outbound_connection_timeout, rrx).await.unwrap() {
match timeout(Duration::from_secs(60), rrx).await.unwrap() {
Ok(Err(P2pError::DialError(DialError::ConnectionRefusedOrTimedOut))) => {}
event => panic!("unexpected event: {event:?}"),
}
}

// Address is reserved for "TEST-NET-2" documentation and examples. See: https://en.wikipedia.org/wiki/Reserved_IP_addresses
const GUARANTEED_TIMEOUT_ADDRESS: &str = "198.51.100.2:1";

#[tokio::test]
async fn connection_timeout_rpc_notified_tcp() {
connection_timeout_rpc_notified::<DefaultNetworkingService<TcpTransportSocket>>(
TestTransportTcp::make_transport(),
TestTransportTcp::make_address(),
TestTcpAddressMaker::new(),
GUARANTEED_TIMEOUT_ADDRESS.parse().unwrap(),
)
.await;
}
Expand All @@ -700,7 +703,7 @@ async fn connection_timeout_rpc_notified_channels() {
connection_timeout_rpc_notified::<DefaultNetworkingService<MpscChannelTransport>>(
TestTransportChannel::make_transport(),
TestTransportChannel::make_address(),
TestTcpAddressMaker::new(),
GUARANTEED_TIMEOUT_ADDRESS.parse().unwrap(),
)
.await;
}
Expand All @@ -710,7 +713,7 @@ async fn connection_timeout_rpc_notified_noise() {
connection_timeout_rpc_notified::<DefaultNetworkingService<NoiseTcpTransport>>(
TestTransportNoise::make_transport(),
TestTransportNoise::make_address(),
TestTcpAddressMaker::new(),
GUARANTEED_TIMEOUT_ADDRESS.parse().unwrap(),
)
.await;
}
Expand Down
1 change: 0 additions & 1 deletion wallet/src/wallet/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,6 @@ fn create_stake_pool_and_list_pool_ids(#[case] seed: Seed) {
let pool_id = pool_ids.first().unwrap().0;
let decommission_tx = wallet
.decommission_stake_pool(
&mut WalletEventsNoOp,
DEFAULT_ACCOUNT_INDEX,
pool_id,
pool_amount,
Expand Down