Rename CLI flag for better ordering of options (#1715)

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
pull/2/head
mbaxter 5 years ago committed by GitHub
parent bbdfe3257d
commit e5a18c70cb
  1. 4
      pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java
  2. 14
      pantheon/src/test/java/tech/pegasys/pantheon/cli/PantheonCommandTest.java
  3. 2
      pantheon/src/test/resources/everything_config.toml

@ -245,7 +245,7 @@ public class PantheonCommand implements DefaultCommandValues, Runnable {
private final Boolean isLimitRemoteWireConnectionsEnabled = true; private final Boolean isLimitRemoteWireConnectionsEnabled = true;
@Option( @Option(
names = {"--max-remote-connections-percentage"}, names = {"--remote-connections-max-percentage"},
paramLabel = MANDATORY_DOUBLE_FORMAT_HELP, paramLabel = MANDATORY_DOUBLE_FORMAT_HELP,
description = description =
"The maximum percentage of P2P connections that can be initiated remotely. Must be between 0 and 100 inclusive. (default: ${DEFAULT-VALUE})", "The maximum percentage of P2P connections that can be initiated remotely. Must be between 0 and 100 inclusive. (default: ${DEFAULT-VALUE})",
@ -796,7 +796,7 @@ public class PantheonCommand implements DefaultCommandValues, Runnable {
"--max-peers", "--max-peers",
"--banned-node-id", "--banned-node-id",
"--banned-node-ids", "--banned-node-ids",
"--max-remote-connections-percentage")); "--remote-connections-max-percentage"));
// Check that mining options are able to work or send an error // Check that mining options are able to work or send an error
checkOptionDependencies( checkOptionDependencies(
logger, logger,

@ -1023,7 +1023,7 @@ public class PantheonCommandTest extends CommandTestAbstract {
"false", "false",
"--max-peers", "--max-peers",
"42", "42",
"--max-remote-connections-percentage", "--remote-connections-max-percentage",
"50", "50",
"--banned-node-id", "--banned-node-id",
String.join(",", nodes), String.join(",", nodes),
@ -1036,7 +1036,7 @@ public class PantheonCommandTest extends CommandTestAbstract {
"--bootnodes", "--bootnodes",
"--max-peers", "--max-peers",
"--banned-node-ids", "--banned-node-ids",
"--max-remote-connections-percentage"); "--remote-connections-max-percentage");
assertThat(commandOutput.toString()).isEmpty(); assertThat(commandOutput.toString()).isEmpty();
assertThat(commandErrorOutput.toString()).isEmpty(); assertThat(commandErrorOutput.toString()).isEmpty();
@ -1247,7 +1247,7 @@ public class PantheonCommandTest extends CommandTestAbstract {
final int remoteConnectionsPercentage = 12; final int remoteConnectionsPercentage = 12;
parseCommand( parseCommand(
"--remote-connections-limit-enabled", "--remote-connections-limit-enabled",
"--max-remote-connections-percentage", "--remote-connections-max-percentage",
String.valueOf(remoteConnectionsPercentage)); String.valueOf(remoteConnectionsPercentage));
verify(mockRunnerBuilder).fractionRemoteConnectionsAllowed(floatCaptor.capture()); verify(mockRunnerBuilder).fractionRemoteConnectionsAllowed(floatCaptor.capture());
@ -1265,12 +1265,12 @@ public class PantheonCommandTest extends CommandTestAbstract {
public void remoteConnectionsPercentageWithInvalidFormatMustFail() { public void remoteConnectionsPercentageWithInvalidFormatMustFail() {
parseCommand( parseCommand(
"--remote-connections-limit-enabled", "--max-remote-connections-percentage", "invalid"); "--remote-connections-limit-enabled", "--remote-connections-max-percentage", "invalid");
verifyZeroInteractions(mockRunnerBuilder); verifyZeroInteractions(mockRunnerBuilder);
assertThat(commandOutput.toString()).isEmpty(); assertThat(commandOutput.toString()).isEmpty();
assertThat(commandErrorOutput.toString()) assertThat(commandErrorOutput.toString())
.contains( .contains(
"Invalid value for option '--max-remote-connections-percentage'", "Invalid value for option '--remote-connections-max-percentage'",
"should be a number between 0 and 100 inclusive"); "should be a number between 0 and 100 inclusive");
} }
@ -1278,12 +1278,12 @@ public class PantheonCommandTest extends CommandTestAbstract {
public void remoteConnectionsPercentageWithOutOfRangeMustFail() { public void remoteConnectionsPercentageWithOutOfRangeMustFail() {
parseCommand( parseCommand(
"--remote-connections-limit-enabled", "--max-remote-connections-percentage", "150"); "--remote-connections-limit-enabled", "--remote-connections-max-percentage", "150");
verifyZeroInteractions(mockRunnerBuilder); verifyZeroInteractions(mockRunnerBuilder);
assertThat(commandOutput.toString()).isEmpty(); assertThat(commandOutput.toString()).isEmpty();
assertThat(commandErrorOutput.toString()) assertThat(commandErrorOutput.toString())
.contains( .contains(
"Invalid value for option '--max-remote-connections-percentage'", "Invalid value for option '--remote-connections-max-percentage'",
"should be a number between 0 and 100 inclusive"); "should be a number between 0 and 100 inclusive");
} }

@ -28,7 +28,7 @@ p2p-host="1.2.3.4"
p2p-port=1234 p2p-port=1234
max-peers=42 max-peers=42
remote-connections-limit-enabled=true remote-connections-limit-enabled=true
max-remote-connections-percentage=60 remote-connections-max-percentage=60
host-whitelist=["all"] host-whitelist=["all"]
# chain # chain

Loading…
Cancel
Save