[NC-2105] Updated --bootnodes CLI option to take zero arguments, to configure Pantheon to run in 'bootnode' mode. (#548)

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
pull/2/head
mark-terry 6 years ago committed by GitHub
parent 10f7fef3ec
commit 2dcd537148
  1. 2
      pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java
  2. 24
      pantheon/src/test/java/tech/pegasys/pantheon/cli/PantheonCommandTest.java

@ -179,7 +179,7 @@ public class PantheonCommand implements DefaultCommandValues, Runnable {
"Comma separated enode URLs for P2P discovery bootstrap. "
+ "Default is a predefined list.",
split = ",",
arity = "1..*",
arity = "0..*",
converter = EnodeToURIPropertyConverter.class
)
private final Collection<URI> bootstrapNodes = null;

@ -489,6 +489,7 @@ public class PantheonCommandTest extends CommandTestAbstract {
assertThat(commandErrorOutput.toString()).isEmpty();
}
@Ignore("NC-2015 - Temporarily enabling zero-arg --bootnodes to permit 'bootnode' configuration")
@Test
public void callingWithBootnodesOptionButNoValueMustDisplayErrorAndUsage() {
parseCommand("--bootnodes");
@ -498,6 +499,21 @@ public class PantheonCommandTest extends CommandTestAbstract {
assertThat(commandErrorOutput.toString()).startsWith(expectedErrorOutputStart);
}
@Test
public void callingWithBootnodesOptionButNoValueMustPassEmptyBootnodeList() {
parseCommand("--bootnodes");
verify(mockRunnerBuilder).bootstrapPeers(uriListArgumentCaptor.capture());
verify(mockRunnerBuilder).build();
assertThat(uriListArgumentCaptor.getValue()).isEmpty();
assertThat(commandOutput.toString()).isEmpty();
assertThat(commandErrorOutput.toString()).isEmpty();
}
@Ignore(
"NC-2015 - Temporarily enabling zero-arg --bootnodes to permit 'bootnode' configuration, which changes the error.")
@Test
public void callingWithInvalidBootnodesMustDisplayErrorAndUsage() {
parseCommand("--bootnodes", "invalid_enode_url");
@ -507,6 +523,14 @@ public class PantheonCommandTest extends CommandTestAbstract {
assertThat(commandErrorOutput.toString()).startsWith(expectedErrorOutputStart);
}
@Test
public void callingWithInvalidBootnodesAndZeroArityMustDisplayAlternateErrorAndUsage() {
parseCommand("--bootnodes", "invalid_enode_url");
assertThat(commandOutput.toString()).isEmpty();
final String expectedErrorOutputStart = "Unmatched argument: invalid_enode_url";
assertThat(commandErrorOutput.toString()).startsWith(expectedErrorOutputStart);
}
@Test
public void callingWithBannedNodeidsOptionButNoValueMustDisplayErrorAndUsage() {
parseCommand("--banned-nodeids");

Loading…
Cancel
Save