Skip to content

Commit

Permalink
Merge pull request #4573 from eval-exec/exec/fix-ci
Browse files Browse the repository at this point in the history
Integration Test: Increase wait timeout for LastCommonHeaderForPeerWithWorseChain
  • Loading branch information
zhangsoledad authored Aug 8, 2024
2 parents d59ce9c + 9700672 commit b866491
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
16 changes: 16 additions & 0 deletions test/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,22 @@ impl Node {
Ok(config)
}

pub fn wait_find_unverified_blocks_finished(&self) {
// wait for node[0] to find unverified blocks finished

let now = std::time::Instant::now();
while !self
.access_log(|line: &str| line.contains("find unverified blocks finished"))
.expect("node[0] must have log")
{
std::thread::sleep(std::time::Duration::from_secs(1));
if now.elapsed() > Duration::from_secs(60) {
panic!("node[0] should find unverified blocks finished in 60s");
}
info!("waiting for node[0] to find unverified blocks finished");
}
}

pub fn access_log<F>(&self, line_checker: F) -> io::Result<bool>
where
F: Fn(&str) -> bool,
Expand Down
2 changes: 1 addition & 1 deletion test/src/specs/sync/last_common_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl Spec for LastCommonHeaderForPeerWithWorseChain {
}

// peer.last_common_header is expect to be advanced to peer.best_known_header
let last_common_header_synced = wait_until(10, || {
let last_common_header_synced = wait_until(20, || {
let sync_state = node0
.rpc_client()
.get_peers()
Expand Down
15 changes: 2 additions & 13 deletions test/src/specs/sync/sync_invalid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,9 @@ impl Spec for SyncInvalid {
fn run(&self, nodes: &mut Vec<Node>) {
nodes[0].mine(20);

{
// wait for node[0] to find unverified blocks finished
// wait for node[0] to find unverified blocks finished
nodes[0].wait_find_unverified_blocks_finished();

let now = std::time::Instant::now();
while !nodes[0]
.access_log(|line: &str| line.contains("find unverified blocks finished"))
.expect("node[0] must have log")
{
if now.elapsed() > Duration::from_secs(60) {
panic!("node[0] should find unverified blocks finished in 60s");
}
info!("waiting for node[0] to find unverified blocks finished");
}
}
nodes[1].mine(1);

nodes[0].connect(&nodes[1]);
Expand Down

0 comments on commit b866491

Please sign in to comment.