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 { mod tests {
use bank::Bank; use bank::Bank;
use crdt::Node; use crdt::Node;
use fullnode::{Fullnode, FullnodeReturnType}; use fullnode::{Fullnode, NodeRole, TvuReturnType};
use ledger::genesis; use ledger::genesis;
use packet::make_consecutive_blobs; use packet::make_consecutive_blobs;
use service::Service; use service::Service;
@ -693,10 +693,21 @@ mod tests {
t_responder t_responder
}; };
// Wait for validator to shut down tvu and restart tpu // Wait for validator to shut down tvu
match validator.handle_role_transition().unwrap() { let node_role = validator.node_role.take();
Some(FullnodeReturnType::LeaderRotation) => (), match node_role {
_ => panic!("Expected reason for exit to be leader rotation"), 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 // 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); leader_scheduler.generate_schedule(bootstrap_height, &bank);
// The leader outside of the newly generated schedule window: // 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 // should be undefined
assert_eq!( assert_eq!(
leader_scheduler.get_scheduled_leader(bootstrap_height - 1), leader_scheduler.get_scheduled_leader(bootstrap_height - 1),