Fix Storage Stage not receiving entries when node is leader (#3528)

This commit is contained in:
Sagar Dhawan
2019-03-27 13:10:33 -07:00
committed by GitHub
parent 47b6707c07
commit 36ea088387
8 changed files with 74 additions and 29 deletions

View File

@ -98,17 +98,16 @@ fn download_from_replicator(replicator_info: &ContactInfo) {
assert!(received_blob);
}
#[test]
fn test_replicator_startup_basic() {
/// Start the cluster with the given configuration and wait till the replicators are discovered
/// Then download blobs from one of them.
fn run_replicator_startup_basic(num_nodes: usize, num_replicators: usize) {
solana_logger::setup();
info!("starting replicator test");
const NUM_NODES: usize = 2;
let num_replicators = 1;
let mut fullnode_config = FullnodeConfig::default();
fullnode_config.storage_rotate_count = STORAGE_ROTATE_TEST_COUNT;
let cluster = LocalCluster::new_with_config_replicators(
&[100; NUM_NODES],
&vec![100; num_nodes],
10_000,
&fullnode_config,
num_replicators,
@ -118,10 +117,10 @@ fn test_replicator_startup_basic() {
let cluster_nodes = discover(
&cluster.entry_point_info.gossip,
NUM_NODES + num_replicators,
num_nodes + num_replicators,
)
.unwrap();
assert_eq!(cluster_nodes.len(), NUM_NODES + num_replicators);
assert_eq!(cluster_nodes.len(), num_nodes + num_replicators);
let mut replicator_count = 0;
let mut replicator_info = ContactInfo::default();
for node in &cluster_nodes {
@ -136,6 +135,16 @@ fn test_replicator_startup_basic() {
download_from_replicator(&replicator_info);
}
#[test]
fn test_replicator_startup_1_node() {
run_replicator_startup_basic(1, 1);
}
#[test]
fn test_replicator_startup_2_nodes() {
run_replicator_startup_basic(2, 1);
}
#[test]
fn test_replicator_startup_leader_hang() {
use std::net::{IpAddr, Ipv4Addr, SocketAddr};