bench-tps/net sanity: add ability to check for unexpected extra nodes

This commit is contained in:
Michael Vines
2018-09-11 20:00:49 -07:00
parent 9ab5692acf
commit f06113500d
6 changed files with 41 additions and 4 deletions

View File

@@ -431,6 +431,11 @@ fn main() {
.takes_value(true)
.help("wait for NUM nodes to converge"),
)
.arg(
Arg::with_name("reject-extra-nodes")
.long("reject-extra-nodes")
.help("require exactly num-nodes on convergence. Appropriate only for internal networks"),
)
.arg(
Arg::with_name("threads")
.short("t")
@@ -517,6 +522,16 @@ fn main() {
);
exit(1);
}
if matches.is_present("reject-extra-nodes") {
if nodes.len() > num_nodes {
println!(
"Error: Extra nodes discovered. Expecting exactly {}",
num_nodes
);
exit(1);
}
}
if leader.is_none() {
println!("no leader");
exit(1);