Fix test stalling (#11212)

Co-authored-by: Carl <carl@solana.com>
This commit is contained in:
carllin
2020-07-25 21:30:08 -07:00
committed by GitHub
parent 01ff6846f7
commit b7d8e256a5

View File

@ -324,22 +324,29 @@ pub fn check_no_new_roots(
let end_slot = max_slot + num_slots_to_wait as u64; let end_slot = max_slot + num_slots_to_wait as u64;
let mut current_slot; let mut current_slot;
let mut last_print = Instant::now(); let mut last_print = Instant::now();
let client = create_client(contact_infos[0].client_facing_addr(), VALIDATOR_PORT_RANGE); let mut reached_end_slot = false;
loop { loop {
for contact_info in contact_infos {
let client = create_client(contact_info.client_facing_addr(), VALIDATOR_PORT_RANGE);
current_slot = client current_slot = client
.get_slot_with_commitment(CommitmentConfig::recent()) .get_slot_with_commitment(CommitmentConfig::recent())
.unwrap_or_else(|_| panic!("get_slot for {} failed", contact_infos[0].id)); .unwrap_or_else(|_| panic!("get_slot for {} failed", contact_infos[0].id));
if current_slot > end_slot { if current_slot > end_slot {
reached_end_slot = true;
break; break;
} }
if last_print.elapsed().as_secs() > 3 { if last_print.elapsed().as_secs() > 3 {
info!( info!(
"{} current slot: {}, waiting for slot: {}", "{} current slot: {} on validator: {}, waiting for any validator with slot: {}",
test_name, current_slot, end_slot test_name, current_slot, contact_info.id, end_slot
); );
last_print = Instant::now(); last_print = Instant::now();
} }
} }
if reached_end_slot {
break;
}
}
for (i, ingress_node) in contact_infos.iter().enumerate() { for (i, ingress_node) in contact_infos.iter().enumerate() {
let client = create_client(ingress_node.client_facing_addr(), VALIDATOR_PORT_RANGE); let client = create_client(ingress_node.client_facing_addr(), VALIDATOR_PORT_RANGE);