Add wait for max stake command (#13532) (#14137)

(cherry picked from commit 598e5f58d5)

Co-authored-by: sakridge <sakridge@gmail.com>
This commit is contained in:
mergify[bot]
2020-12-16 01:32:00 +00:00
committed by GitHub
parent db339cb925
commit fdb1c5ab06
5 changed files with 87 additions and 11 deletions

View File

@@ -1350,6 +1350,26 @@ fn test_faulty_node(faulty_node_type: BroadcastStageType) {
cluster.check_for_new_roots(16, &"test_faulty_node");
}
#[test]
fn test_wait_for_max_stake() {
solana_logger::setup();
let mut validator_config = ValidatorConfig::default();
validator_config.rpc_config.enable_validator_exit = true;
let mut config = ClusterConfig {
cluster_lamports: 10_000,
node_stakes: vec![100; 4],
validator_configs: vec![validator_config; 4],
..ClusterConfig::default()
};
let cluster = LocalCluster::new(&mut config);
let client = RpcClient::new_socket(cluster.entry_point_info.rpc);
assert!(client
.wait_for_max_stake(CommitmentConfig::default(), 33.0f32)
.is_ok());
assert!(client.get_slot().unwrap() > 10);
}
#[test]
// Test that when a leader is leader for banks B_i..B_{i+n}, and B_i is not
// votable, then B_{i+1} still chains to B_i