Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sistemd committed Jan 18, 2024
1 parent 6db5639 commit 1f332f9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions crates/p2p/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,8 @@ async fn duplicate_connection() {
// Bootstrapping can cause redials, so set the offset to a high value.
start_offset: Duration::from_secs(10),
},
connection_timeout: CONNECTION_TIMEOUT,
direct_connection_timeout: CONNECTION_TIMEOUT,
relay_connection_timeout: Duration::from_millis(500),
};
let keypair = Keypair::generate_ed25519();
let mut peer1 = TestPeer::new(periodic_cfg, keypair.clone());
Expand All @@ -421,15 +422,15 @@ async fn duplicate_connection() {
.await
.unwrap();

wait_event(&mut peer1.event_receiver, |event| match event {
wait_for_event(&mut peer1.event_receiver, |event| match event {
Event::Test(TestEvent::ConnectionEstablished { remote, .. }) if remote == peer2.peer_id => {
Some(())
}
_ => None,
})
.await;

wait_event(&mut peer2.event_receiver, |event| match event {
wait_for_event(&mut peer2.event_receiver, |event| match event {
Event::Test(TestEvent::ConnectionEstablished { remote, .. }) if remote == peer1.peer_id => {
Some(())
}
Expand All @@ -449,15 +450,15 @@ async fn duplicate_connection() {
.await
.unwrap();

wait_event(&mut peer1_copy.event_receiver, |event| match event {
wait_for_event(&mut peer1_copy.event_receiver, |event| match event {
Event::Test(TestEvent::ConnectionEstablished { remote, .. }) if remote == peer2.peer_id => {
Some(())
}
_ => None,
})
.await;

wait_event(&mut peer1_copy.event_receiver, |event| match event {
wait_for_event(&mut peer1_copy.event_receiver, |event| match event {
Event::Test(TestEvent::ConnectionClosed { remote, .. }) if remote == peer2.peer_id => {
Some(())
}
Expand Down

0 comments on commit 1f332f9

Please sign in to comment.