Use built-in solana-gossip timeout for better error messages (#6189)

This commit is contained in:
Michael Vines 2019-10-01 12:30:11 -07:00 committed by GitHub
parent 8d0236e3f1
commit 8e888059d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -111,7 +111,7 @@ fn main() -> Result<(), Box<dyn error::Error>> {
if let Some(addr) = matches.value_of("entrypoint") { if let Some(addr) = matches.value_of("entrypoint") {
entrypoint_addr = solana_netutil::parse_host_port(addr).unwrap_or_else(|e| { entrypoint_addr = solana_netutil::parse_host_port(addr).unwrap_or_else(|e| {
eprintln!("failed to parse entrypoint address: {}", e); eprintln!("failed to parse entrypoint address: {}", e);
exit(1) exit(1);
}); });
} }
@ -120,7 +120,7 @@ fn main() -> Result<(), Box<dyn error::Error>> {
addr.set_ip( addr.set_ip(
solana_netutil::get_public_ip_addr(&entrypoint_addr).unwrap_or_else(|err| { solana_netutil::get_public_ip_addr(&entrypoint_addr).unwrap_or_else(|err| {
eprintln!("failed to contact {}: {}", entrypoint_addr, err); eprintln!("failed to contact {}: {}", entrypoint_addr, err);
exit(1) exit(1);
}), }),
); );
Some(addr) Some(addr)
@ -163,11 +163,13 @@ fn main() -> Result<(), Box<dyn error::Error>> {
"Error: Insufficient nodes discovered. Expecting {}{}", "Error: Insufficient nodes discovered. Expecting {}{}",
num, add, num, add,
); );
exit(1);
} }
} }
if let Some(node) = pubkey { if let Some(node) = pubkey {
if nodes.iter().find(|x| x.id == node).is_none() { if nodes.iter().find(|x| x.id == node).is_none() {
eprintln!("Error: Could not find node {:?}", node); eprintln!("Error: Could not find node {:?}", node);
exit(1);
} }
} }
} }
@ -176,6 +178,7 @@ fn main() -> Result<(), Box<dyn error::Error>> {
"Error: Extra nodes discovered. Expecting exactly {}", "Error: Extra nodes discovered. Expecting exactly {}",
num_nodes_exactly.unwrap() num_nodes_exactly.unwrap()
); );
exit(1);
} }
} }
("get-rpc-url", Some(matches)) => { ("get-rpc-url", Some(matches)) => {
@ -220,6 +223,7 @@ fn main() -> Result<(), Box<dyn error::Error>> {
if !ContactInfo::is_valid_address(&node.rpc) { if !ContactInfo::is_valid_address(&node.rpc) {
eprintln!("Error: RPC service is not enabled on node {:?}", pubkey); eprintln!("Error: RPC service is not enabled on node {:?}", pubkey);
exit(1);
} }
println!("\nSending stop request to node {:?}", pubkey); println!("\nSending stop request to node {:?}", pubkey);

View File

@ -94,8 +94,8 @@ echo "+++ $sanityTargetIp: node count ($numSanityNodes expected)"
nodeArg="num-nodes-exactly" nodeArg="num-nodes-exactly"
fi fi
timeout 2m $solana_gossip --entrypoint "$sanityTargetIp:8001" \ $solana_gossip --entrypoint "$sanityTargetIp:8001" \
spy --$nodeArg "$numSanityNodes" \ spy --$nodeArg "$numSanityNodes" --timeout 60 \
) )
echo "--- $sanityTargetIp: RPC API: getTransactionCount" echo "--- $sanityTargetIp: RPC API: getTransactionCount"