Skip to content
This repository has been archived by the owner on Dec 26, 2024. It is now read-only.

Commit

Permalink
test(network): test discovery doesn't redial after DIAL_SLEEP - epsil…
Browse files Browse the repository at this point in the history
…on (#1975)
  • Loading branch information
ShahakShama authored May 15, 2024
1 parent ccb104a commit fab814d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/papyrus_network/src/discovery/discovery_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ async fn discovery_outputs_dial_request_on_start_without_query() {

#[tokio::test]
async fn discovery_redials_on_dial_failure() {
const EPSILON_SLEEP: Duration = Duration::from_millis(10);

let bootstrap_peer_id = PeerId::random();
let bootstrap_peer_address = Multiaddr::empty();

Expand All @@ -92,10 +94,11 @@ async fn discovery_redials_on_dial_failure() {

// Check that there are no events until we sleep for enough time.
tokio::time::pause();
tokio::time::advance(DIAL_SLEEP - EPSILON_SLEEP).await;
assert_no_event(&mut behaviour);

// Sleep and check for event.
tokio::time::advance(DIAL_SLEEP).await;
tokio::time::advance(EPSILON_SLEEP).await;
tokio::time::resume();
let event = timeout(TIMEOUT, behaviour.next()).await.unwrap().unwrap();
assert_matches!(
Expand Down

0 comments on commit fab814d

Please sign in to comment.