Skip to content

Commit

Permalink
[CI Stability] Immediately fail test on Libp2p panic (#2430)
Browse files Browse the repository at this point in the history
* fix panic

* fix lints

* lints x2

* set timeout coverage back
  • Loading branch information
rob-maron authored Jan 23, 2024
1 parent f3c4b35 commit 5127ebe
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions libp2p-networking/tests/counter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,17 @@ async fn run_request_response_increment<'a>(

match stream.next().await.unwrap() {
Ok(()) => {}
Err(e) => panic!("timeout : {e:?} waiting handle {requestee_pid:?} to update state"),
Err(e) => {error!("timed out waiting for {requestee_pid:?} to update state: {e}");
std::process::exit(-1)},
}
requester_handle
.direct_request(requestee_pid, &CounterMessage::AskForCounter)
.await
.context(HandleSnafu)?;
match stream.next().await.unwrap() {
Ok(()) => {}
Err(e) => panic!("timeout : {e:?} waiting handle {requestee_pid:?} to update state"),
}
Err(e) => {error!("timed out waiting for {requestee_pid:?} to update state: {e}");
std::process::exit(-1)}, }

let s1 = requester_handle.state().await;

Expand Down Expand Up @@ -212,7 +213,10 @@ async fn run_gossip_round(
// unwrap is okay because stream must have 2 * (len - 1) elements
match merged_streams.next().await.unwrap() {
Ok(()) => {}
Err(e) => panic!("timeout : {e:?} waiting handle {i:?} to subscribe to state events"),
Err(e) => {
error!("timed out waiting for handle {i:?} to subscribe to state events: {e}");
std::process::exit(-1)
}
}
}

Expand Down Expand Up @@ -343,7 +347,8 @@ async fn run_dht_rounds(
handle.get_record_timeout(&key, timeout).await;
match result {
Err(e) => {
panic!("DHT error {e:?} during GET");
error!("DHT error {e:?} during GET");
std::process::exit(-1);
}
Ok(v) => {
assert_eq!(v, value);
Expand Down Expand Up @@ -435,7 +440,8 @@ async fn run_request_response_increment_all(
for handle in handles {
states.push(handle.state().await);
}
panic!("states: {states:?}");
error!("states: {states:?}");
std::process::exit(-1);
}
}

Expand Down

0 comments on commit 5127ebe

Please sign in to comment.