Skip to content

Commit

Permalink
Merge pull request #5 from zeroqn/fix-trust-metrics-integration-tests…
Browse files Browse the repository at this point in the history
…-panic-rpc-timeout

fix(trust_metric_test): rpc timeout failure after full node panic
  • Loading branch information
yejiayu authored Jul 3, 2020
2 parents 76529e9 + f5110ba commit ec82837
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/trust_metric_all/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ mod node;
use futures::future::BoxFuture;
use node::client_node::{ClientNode, ClientNodeError};

use std::panic;

const FULL_NODE_SETUP_WAIT_TIME: u64 = 5;

fn trust_test(test: impl FnOnce(ClientNode) -> BoxFuture<'static, ()> + Send + 'static) {
Expand All @@ -18,7 +20,9 @@ fn trust_test(test: impl FnOnce(ClientNode) -> BoxFuture<'static, ()> + Send + '

local.block_on(&mut rt, async move {
let running = common::RunningStatus::new();
tokio::task::spawn_local(node::full_node::run(full_port, running.clone()));
let _ = panic::catch_unwind(panic::AssertUnwindSafe(|| {
let _ = tokio::task::spawn_local(node::full_node::run(full_port, running.clone()));
}));
// Sleep a while for full node network to running, otherwise will
// trigger network retry back off.
tokio::time::delay_for(std::time::Duration::from_secs(FULL_NODE_SETUP_WAIT_TIME)).await;
Expand Down

0 comments on commit ec82837

Please sign in to comment.