Enable more fine-grained control in partition tests (#10418)
Co-authored-by: Carl <carl@solana.com>
This commit is contained in:
@ -284,7 +284,7 @@ pub fn kill_entry_and_spend_and_verify_rest(
|
||||
}
|
||||
}
|
||||
|
||||
pub fn check_for_new_roots(num_new_roots: usize, contact_infos: &[ContactInfo]) {
|
||||
pub fn check_for_new_roots(num_new_roots: usize, contact_infos: &[ContactInfo], test_name: &str) {
|
||||
let mut roots = vec![HashSet::new(); contact_infos.len()];
|
||||
let mut done = false;
|
||||
let mut last_print = Instant::now();
|
||||
@ -295,7 +295,7 @@ pub fn check_for_new_roots(num_new_roots: usize, contact_infos: &[ContactInfo])
|
||||
roots[i].insert(slot);
|
||||
let min_node = roots.iter().map(|r| r.len()).min().unwrap_or(0);
|
||||
if last_print.elapsed().as_secs() > 3 {
|
||||
info!("PARTITION_TEST min observed roots {}/16", min_node);
|
||||
info!("{} min observed roots {}/16", test_name, min_node);
|
||||
last_print = Instant::now();
|
||||
}
|
||||
done = min_node >= num_new_roots;
|
||||
|
@ -1,4 +1,7 @@
|
||||
use crate::cluster::{Cluster, ClusterValidatorInfo, ValidatorInfo};
|
||||
use crate::{
|
||||
cluster::{Cluster, ClusterValidatorInfo, ValidatorInfo},
|
||||
cluster_tests,
|
||||
};
|
||||
use itertools::izip;
|
||||
use log::*;
|
||||
use solana_client::thin_client::{create_client, ThinClient};
|
||||
@ -137,7 +140,7 @@ impl LocalCluster {
|
||||
OperatingMode::Stable | OperatingMode::Preview => {
|
||||
genesis_config.native_instruction_processors =
|
||||
solana_genesis_programs::get_programs(genesis_config.operating_mode, 0)
|
||||
.unwrap_or_else(|| vec![])
|
||||
.unwrap_or_default()
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
@ -336,6 +339,25 @@ impl LocalCluster {
|
||||
Self::transfer_with_client(&client, source_keypair, dest_pubkey, lamports)
|
||||
}
|
||||
|
||||
pub fn check_for_new_roots(&self, num_new_roots: usize, test_name: &str) {
|
||||
let alive_node_contact_infos: Vec<_> = self
|
||||
.validators
|
||||
.values()
|
||||
.map(|v| v.info.contact_info.clone())
|
||||
.collect();
|
||||
assert!(!alive_node_contact_infos.is_empty());
|
||||
info!("{} discovering nodes", test_name);
|
||||
let cluster_nodes = discover_cluster(
|
||||
&alive_node_contact_infos[0].gossip,
|
||||
alive_node_contact_infos.len(),
|
||||
)
|
||||
.unwrap();
|
||||
info!("{} discovered {} nodes", test_name, cluster_nodes.len());
|
||||
info!("{} looking for new roots on all nodes", test_name);
|
||||
cluster_tests::check_for_new_roots(num_new_roots, &alive_node_contact_infos, test_name);
|
||||
info!("{} done waiting for roots", test_name);
|
||||
}
|
||||
|
||||
fn transfer_with_client(
|
||||
client: &ThinClient,
|
||||
source_keypair: &Keypair,
|
||||
|
Reference in New Issue
Block a user