Skip to content

Commit 9cad386

Browse files
committed
Make test_nakamoto_inv_sync_across_epoch_change panic instead of timing out CI
Signed-off-by: Jacinta Ferrant <[email protected]>
1 parent 53bf9ea commit 9cad386

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

stackslib/src/net/tests/inv/nakamoto.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,6 +1008,8 @@ fn test_nakamoto_inv_sync_across_epoch_change() {
10081008
.block_height_to_reward_cycle(tip.block_height)
10091009
.unwrap();
10101010

1011+
let timeout = std::time::Duration::from_secs(30);
1012+
let start = std::time::Instant::now();
10111013
// run peer and other_peer until they connect
10121014
loop {
10131015
let _ = peer.step_with_ibd(false);
@@ -1019,6 +1021,10 @@ fn test_nakamoto_inv_sync_across_epoch_change() {
10191021
if event_ids.count() > 0 && other_event_ids.count() > 0 {
10201022
break;
10211023
}
1024+
assert!(
1025+
start.elapsed() < timeout,
1026+
"Timed out waiting for peer's to connect"
1027+
);
10221028
}
10231029

10241030
debug!("Peers are connected");
@@ -1036,6 +1042,7 @@ fn test_nakamoto_inv_sync_across_epoch_change() {
10361042

10371043
let burn_tip_start = peer.network.get_current_epoch().start_height;
10381044

1045+
let start = std::time::Instant::now();
10391046
while inv_1_count < num_epoch2_blocks
10401047
|| inv_2_count < num_epoch2_blocks
10411048
|| highest_rc_1 < total_rcs
@@ -1098,6 +1105,11 @@ fn test_nakamoto_inv_sync_across_epoch_change() {
10981105
info!(
10991106
"Nakamoto state machine: Peer 1: {highest_rc_1}, Peer 2: {highest_rc_2} (total {total_rcs})"
11001107
);
1108+
1109+
assert!(
1110+
start.elapsed() < timeout,
1111+
"Timed out waiting for inv sync across epoch. Ran {round} rounds."
1112+
);
11011113
}
11021114
}
11031115

0 commit comments

Comments
 (0)