Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Allow config files to specify no bootnodes #1438

Merged
merged 3 commits into from
May 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,10 @@ protected KeyLoader getKeyLoader() {
void setBootnodes(final List<String> values) {
try {
bootNodes =
values.stream().map((s) -> EnodeURL.fromString(s).toURI()).collect(Collectors.toList());
values.stream()
.filter(value -> !value.isEmpty())
.map(value -> EnodeURL.fromString(value).toURI())
.collect(Collectors.toList());
} catch (final IllegalArgumentException e) {
throw new ParameterException(commandLine, e.getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,22 @@ public void callingWithConfigOptionButInvalidContentTomlFileShouldDisplayHelp()
assertThat(commandOutput.toString()).isEmpty();
}

@Test
public void callingWithNoBootnodesConfig() throws Exception {
assumeTrue(isFullInstantiation());

final URL configFile = this.getClass().getResource("/no_bootnodes.toml");
final Path toml = createTempFile("toml", Resources.toString(configFile, UTF_8));

parseCommand("--config-file", toml.toAbsolutePath().toString());

verify(mockRunnerBuilder).ethNetworkConfig(ethNetworkConfigArgumentCaptor.capture());
assertThat(ethNetworkConfigArgumentCaptor.getValue().getBootNodes()).isEmpty();

assertThat(commandErrorOutput.toString()).isEmpty();
assertThat(commandOutput.toString()).isEmpty();
}

@Test
public void callingWithConfigOptionButInvalidValueTomlFileShouldDisplayHelp() throws Exception {
assumeTrue(isFullInstantiation());
Expand Down
1 change: 1 addition & 0 deletions pantheon/src/test/resources/no_bootnodes.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bootnodes=[]