forked from hyperledger/besu
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added command line option --static-nodes-file (hyperledger#1414) (hyp…
…erledger#1644) Now able to inject static nodes by explicitly specifying a static nodes JSON file (.json) on the command line Co-authored-by: Ratan (Rai) Sur <[email protected]> Signed-off-by: Terrence Cooke <[email protected]>
- Loading branch information
Showing
4 changed files
with
61 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4074,4 +4074,43 @@ public void assertThatCheckPortClashRejectsAsExpected() throws Exception { | |
.contains( | ||
"Port number '8546' has been specified multiple times. Please review the supplied configuration."); | ||
} | ||
|
||
@Test | ||
public void staticNodesFileOptionValueAbsentMessage() { | ||
parseCommand("--static-nodes-file"); | ||
assertThat(commandErrorOutput.toString()).startsWith("Missing required parameter for option"); | ||
} | ||
|
||
@Test | ||
public void staticNodesFilesOptionInvalidJSONFormatError() throws IOException { | ||
final Path tempfile = | ||
createTempFile( | ||
"static-nodes-badformat.json", | ||
"\"enode://c0b0e1151971f8a22dc2493c622317c8706c731f6fcf46d93104ef" | ||
+ "3a08f21f7750b5d5e17f311091f732c9f917b02e1ae6d39f076903779fd1e7" | ||
+ "[email protected]:30303\"\n]"); | ||
parseCommand("--static-nodes-file", tempfile.toString()); | ||
assertThat(commandErrorOutput.toString()) | ||
.startsWith("Failed to decode:Cannot deserialize instance of"); | ||
} | ||
|
||
@Test | ||
public void staticNodesFileOptionFileDoesNotExistMessage() { | ||
parseCommand("--static-nodes-file", "this-file-does-not-exist-at-all.json"); | ||
assertThat(commandErrorOutput.toString()).contains("Static nodes file", "does not exist"); | ||
} | ||
|
||
@Test | ||
public void staticNodesFileOptionValidParamenter() throws IOException { | ||
final Path staticNodeTempFile = | ||
createTempFile( | ||
"static-nodes-goodformat.json", | ||
"[\n" | ||
+ "\"enode://c0b0e1151971f8a22dc2493c622317c8706c731f6fcf46d93104ef" | ||
+ "3a08f21f7750b5d5e17f311091f732c9f917b02e1ae6d39f076903779fd1e7" | ||
+ "[email protected]:30303\"\n]"); | ||
parseCommand("--static-nodes-file", staticNodeTempFile.toString()); | ||
assertThat(commandOutput.toString()).isEmpty(); | ||
assertThat(commandErrorOutput.toString()).isEmpty(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters