[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. " "Comma separated enode URLs for P2P discovery bootstrap. "
+ "Default is a predefined list.", + "Default is a predefined list.",
split = ",", split = ",",
arity = "1..*", arity = "0..*",
converter = EnodeToURIPropertyConverter.class converter = EnodeToURIPropertyConverter.class
) )
private final Collection<URI> bootstrapNodes = null; private final Collection<URI> bootstrapNodes = null;

@ -489,6 +489,7 @@ public class PantheonCommandTest extends CommandTestAbstract {
assertThat(commandErrorOutput.toString()).isEmpty(); assertThat(commandErrorOutput.toString()).isEmpty();
} }
@Ignore("NC-2015 - Temporarily enabling zero-arg --bootnodes to permit 'bootnode' configuration")
@Test @Test
public void callingWithBootnodesOptionButNoValueMustDisplayErrorAndUsage() { public void callingWithBootnodesOptionButNoValueMustDisplayErrorAndUsage() {
parseCommand("--bootnodes"); parseCommand("--bootnodes");
@ -498,6 +499,21 @@ public class PantheonCommandTest extends CommandTestAbstract {
assertThat(commandErrorOutput.toString()).startsWith(expectedErrorOutputStart); 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 @Test
public void callingWithInvalidBootnodesMustDisplayErrorAndUsage() { public void callingWithInvalidBootnodesMustDisplayErrorAndUsage() {
parseCommand("--bootnodes", "invalid_enode_url"); parseCommand("--bootnodes", "invalid_enode_url");
@ -507,6 +523,14 @@ public class PantheonCommandTest extends CommandTestAbstract {
assertThat(commandErrorOutput.toString()).startsWith(expectedErrorOutputStart); 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 @Test
public void callingWithBannedNodeidsOptionButNoValueMustDisplayErrorAndUsage() { public void callingWithBannedNodeidsOptionButNoValueMustDisplayErrorAndUsage() {
parseCommand("--banned-nodeids"); parseCommand("--banned-nodeids");

Loading…
Cancel
Save