-
Notifications
You must be signed in to change notification settings - Fork 130
PAN-2723: Added static nodes acceptance test #1745
Conversation
|
||
final Path staticNodesFile = tempFile.getParent().resolve("static-nodes.json"); | ||
Files.move(tempFile, staticNodesFile); | ||
staticNodesFile.toFile().deleteOnExit(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we override the file name "static-nodes.json" later on at Pantheon CLI? if we can, then we can avoid the Files.move
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other option is to use Files.createTempDirectory(directory, ...) and then create static-nodes.json in it ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name is hardcoded to static-nodes.json
. The reason I'm not creating a temp directory is 'cause we already have the node home directory to use (that's where the static-nodes.json) file should be.
I'll take a look and see if I can optimize this in my following PR.
@@ -159,6 +160,7 @@ public PantheonNode( | |||
} | |||
}); | |||
this.extraCLIOptions = extraCLIOptions; | |||
this.staticNodes = staticNodes; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we check for null staticNodes and assign a new one?
@@ -154,6 +154,10 @@ public void startNode(final PantheonNode node) { | |||
.metricsConfiguration(node.metricsConfiguration()) | |||
.p2pEnabled(node.isP2pEnabled()) | |||
.graphQLConfiguration(GraphQLConfiguration.createDefault()) | |||
.staticNodes( | |||
node.getStaticNodes().stream() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this has a potential of NPE unless we make sure getStaticNodes will never return null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We always initialize it in PantheonFactoryConfigurationBuilder
as an empty list. There is a lot of indirection to get there but we should be safe for now.
@@ -193,6 +194,11 @@ public PantheonFactoryConfigurationBuilder revertReasonEnabled() { | |||
return this; | |||
} | |||
|
|||
public PantheonFactoryConfigurationBuilder staticNodes(final List<String> staticNodes) { | |||
this.staticNodes = staticNodes; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
null check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good with minor suggestions
No description provided.