Fix validator_to_leader_transition test to not start up tpu after shutting down tvu, as the tpu now outputs ticks that will mess up the verification check

This commit is contained in:
Carl 2018-10-01 11:40:10 -07:00 committed by Greg Fitzgerald
parent 23f3ff3cf0
commit 5491422b12
2 changed files with 17 additions and 6 deletions

View File

@ -550,7 +550,7 @@ impl Service for Fullnode {
mod tests {
use bank::Bank;
use crdt::Node;
use fullnode::{Fullnode, FullnodeReturnType};
use fullnode::{Fullnode, NodeRole, TvuReturnType};
use ledger::genesis;
use packet::make_consecutive_blobs;
use service::Service;
@ -693,10 +693,21 @@ mod tests {
t_responder
};
// Wait for validator to shut down tvu and restart tpu
match validator.handle_role_transition().unwrap() {
Some(FullnodeReturnType::LeaderRotation) => (),
_ => panic!("Expected reason for exit to be leader rotation"),
// Wait for validator to shut down tvu
let node_role = validator.node_role.take();
match node_role {
Some(NodeRole::Validator(validator_services)) => {
let join_result = validator_services
.join()
.expect("Expected successful validator join");
assert_eq!(
join_result,
Some(TvuReturnType::LeaderRotation(
my_leader_begin_epoch * leader_rotation_interval
))
);
}
_ => panic!("Role should not be leader"),
}
// Check the validator ledger to make sure it's the right height

View File

@ -410,7 +410,7 @@ mod tests {
leader_scheduler.generate_schedule(bootstrap_height, &bank);
// The leader outside of the newly generated schedule window:
// [bootstrap_height, bootstrap_height + seed_rotation_interval]
// [bootstrap_height, bootstrap_height + seed_rotation_interval)
// should be undefined
assert_eq!(
leader_scheduler.get_scheduled_leader(bootstrap_height - 1),