Skip to content

Commit

Permalink
Merge pull request #1131 from mintlayer/fix_failing_rpc_notified_test
Browse files Browse the repository at this point in the history
Fix connection_timeout_rpc_notified test (p2p)
  • Loading branch information
TheQuantumPhysicist committed Aug 3, 2023
2 parents 11b34d6 + 8d1925a commit 197e4d9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
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

0 comments on commit 197e4d9

Please sign in to comment.