diff --git a/pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java b/pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java index 73dd539982..bd91c7a141 100644 --- a/pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java +++ b/pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.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 bootstrapNodes = null; diff --git a/pantheon/src/test/java/tech/pegasys/pantheon/cli/PantheonCommandTest.java b/pantheon/src/test/java/tech/pegasys/pantheon/cli/PantheonCommandTest.java index d66b95f154..7247b693fc 100644 --- a/pantheon/src/test/java/tech/pegasys/pantheon/cli/PantheonCommandTest.java +++ b/pantheon/src/test/java/tech/pegasys/pantheon/cli/PantheonCommandTest.java @@ -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");