Restore discover_cluster to avoid test panics

This commit is contained in:
Michael Vines
2020-12-01 13:54:15 -08:00
parent 3eece38ffa
commit 0a8bc347a1

View File

@ -1,6 +1,7 @@
use { use {
crate::{ crate::{
cluster_info::Node, cluster_info::Node,
gossip_service::discover_cluster,
validator::{Validator, ValidatorConfig}, validator::{Validator, ValidatorConfig},
}, },
solana_ledger::create_new_tmp_ledger, solana_ledger::create_new_tmp_ledger,
@ -127,6 +128,7 @@ impl TestValidator {
let rpc_url = format!("http://{}:{}", node.info.rpc.ip(), node.info.rpc.port()); let rpc_url = format!("http://{}:{}", node.info.rpc.ip(), node.info.rpc.port());
let rpc_pubsub_url = format!("ws://{}/", node.info.rpc_pubsub); let rpc_pubsub_url = format!("ws://{}/", node.info.rpc_pubsub);
let tpu = node.info.tpu; let tpu = node.info.tpu;
let gossip = node.info.gossip;
let validator = Validator::new( let validator = Validator::new(
node, node,
@ -138,6 +140,10 @@ impl TestValidator {
&config, &config,
); );
// Needed to avoid panics in `solana-responder-gossip` in tests that create a number of
// test validators concurrently...
discover_cluster(&gossip, 1).expect("TestValidator startup failed");
TestValidator { TestValidator {
validator, validator,
vote_account_address, vote_account_address,