remove host whitelist tests

Signed-off-by: Marlene Marz <m.marz@kabelmail.de>
pull/7884/head
Marlene Marz 5 days ago
parent 2b7f3eb6e9
commit d6a44203ae
  1. 8
      besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
  2. 35
      besu/src/test/java/org/hyperledger/besu/cli/HostAllowlistOptionsTest.java

@ -592,14 +592,6 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
defaultValue = "localhost,127.0.0.1") defaultValue = "localhost,127.0.0.1")
private final JsonRPCAllowlistHostsProperty hostsAllowlist = new JsonRPCAllowlistHostsProperty(); private final JsonRPCAllowlistHostsProperty hostsAllowlist = new JsonRPCAllowlistHostsProperty();
@Option(
names = {"--host-whitelist"},
hidden = true,
paramLabel = "<hostname>[,<hostname>...]... or * or all",
description =
"Deprecated in favor of --host-allowlist. Comma separated list of hostnames to allow for RPC access, or * to accept any host (default: ${DEFAULT-VALUE})")
private final JsonRPCAllowlistHostsProperty hostsWhitelist = new JsonRPCAllowlistHostsProperty();
@SuppressWarnings({"FieldCanBeFinal", "FieldMayBeFinal"}) @SuppressWarnings({"FieldCanBeFinal", "FieldMayBeFinal"})
@Option( @Option(
names = {"--color-enabled"}, names = {"--color-enabled"},

@ -23,24 +23,6 @@ import org.mockito.Mockito;
public class HostAllowlistOptionsTest extends CommandTestAbstract { public class HostAllowlistOptionsTest extends CommandTestAbstract {
/** test deprecated CLI option * */
@Deprecated
@Test
public void rpcHttpHostWhitelistAcceptsSingleArgument() {
parseCommand("--host-whitelist", "a");
verify(mockRunnerBuilder).jsonRpcConfiguration(jsonRpcConfigArgumentCaptor.capture());
verify(mockRunnerBuilder).build();
assertThat(jsonRpcConfigArgumentCaptor.getValue().getHostsAllowlist().size()).isEqualTo(1);
assertThat(jsonRpcConfigArgumentCaptor.getValue().getHostsAllowlist()).contains("a");
assertThat(jsonRpcConfigArgumentCaptor.getValue().getHostsAllowlist())
.doesNotContain("localhost");
assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}
@Test @Test
public void rpcHttpHostAllowlistAcceptsSingleArgument() { public void rpcHttpHostAllowlistAcceptsSingleArgument() {
parseCommand("--host-allowlist", "a"); parseCommand("--host-allowlist", "a");
@ -89,23 +71,6 @@ public class HostAllowlistOptionsTest extends CommandTestAbstract {
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty(); assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
} }
@Deprecated
@Test
public void rpcHttpHostWhitelistAllowlistAcceptsMultipleFlags() {
parseCommand("--host-whitelist=a", "--host-allowlist=b");
verify(mockRunnerBuilder).jsonRpcConfiguration(jsonRpcConfigArgumentCaptor.capture());
verify(mockRunnerBuilder).build();
assertThat(jsonRpcConfigArgumentCaptor.getValue().getHostsAllowlist().size()).isEqualTo(2);
assertThat(jsonRpcConfigArgumentCaptor.getValue().getHostsAllowlist()).contains("a", "b");
assertThat(jsonRpcConfigArgumentCaptor.getValue().getHostsAllowlist())
.doesNotContain("*", "localhost");
assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}
@Test @Test
public void rpcHttpHostAllowlistAcceptsMultipleFlags() { public void rpcHttpHostAllowlistAcceptsMultipleFlags() {
parseCommand("--host-allowlist=a", "--host-allowlist=b"); parseCommand("--host-allowlist=a", "--host-allowlist=b");

Loading…
Cancel
Save