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 7247b693fc..74b726cea9 100644 --- a/pantheon/src/test/java/tech/pegasys/pantheon/cli/PantheonCommandTest.java +++ b/pantheon/src/test/java/tech/pegasys/pantheon/cli/PantheonCommandTest.java @@ -15,6 +15,7 @@ package tech.pegasys.pantheon.cli; import static java.nio.charset.StandardCharsets.UTF_8; import static java.util.Arrays.asList; import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assume.assumeFalse; import static org.junit.Assume.assumeTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; @@ -422,6 +423,18 @@ public class PantheonCommandTest extends CommandTestAbstract { assertThat(commandErrorOutput.toString()).isEmpty(); } + @Test + public void configOptionDisabledUnderDocker() { + System.setProperty("pantheon.docker", "true"); + + assumeFalse(isFullInstantiation()); + + final Path path = Paths.get("."); + parseCommand("--config", path.toString()); + assertThat(commandErrorOutput.toString()).startsWith("Unknown options: --config, ."); + assertThat(commandOutput.toString()).isEmpty(); + } + @Test public void nodekeyOptionMustBeUsed() throws Exception { final File file = new File("./specific/key"); @@ -458,6 +471,31 @@ public class PantheonCommandTest extends CommandTestAbstract { assertThat(commandErrorOutput.toString()).isEmpty(); } + @Test + public void dataDirDisabledUnderDocker() { + System.setProperty("pantheon.docker", "true"); + + assumeFalse(isFullInstantiation()); + + final Path path = Paths.get("."); + + parseCommand("--datadir", path.toString()); + assertThat(commandErrorOutput.toString()).startsWith("Unknown options: --datadir, ."); + assertThat(commandOutput.toString()).isEmpty(); + } + + @Test + public void dataDirDefaultedUnderDocker() { + System.setProperty("pantheon.docker", "true"); + + assumeFalse(isFullInstantiation()); + + parseCommand(); + + verify(mockControllerBuilder).homePath(pathArgumentCaptor.capture()); + assertThat(pathArgumentCaptor.getValue()).isEqualByComparingTo(Paths.get("/var/lib/pantheon")); + } + @Test public void genesisPathOptionMustBeUsed() throws Exception { assumeTrue(isFullInstantiation()); @@ -477,6 +515,19 @@ public class PantheonCommandTest extends CommandTestAbstract { assertThat(commandErrorOutput.toString()).isEmpty(); } + @Test + public void genesisPathDisabledUnderDocker() { + System.setProperty("pantheon.docker", "true"); + + assumeFalse(isFullInstantiation()); + + final Path path = Paths.get("."); + + parseCommand("--genesis", path.toString()); + assertThat(commandErrorOutput.toString()).startsWith("Unknown options: --genesis, ."); + assertThat(commandOutput.toString()).isEmpty(); + } + @Test public void discoveryOptionMustBeUsed() { parseCommand("--no-discovery");