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

PAN-2723: Added static nodes acceptance test #1745

Merged
merged 1 commit into from
Jul 24, 2019

Conversation

lucassaldanha
Copy link
Contributor

No description provided.


final Path staticNodesFile = tempFile.getParent().resolve("static-nodes.json");
Files.move(tempFile, staticNodesFile);
staticNodesFile.toFile().deleteOnExit();
Copy link
Contributor

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.

Copy link
Contributor

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 ...

Copy link
Contributor Author

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;
Copy link
Contributor

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()
Copy link
Contributor

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.

Copy link
Contributor Author

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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null check?

Copy link
Contributor

@usmansaleem usmansaleem left a 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

@lucassaldanha lucassaldanha merged commit 3d1d766 into PegaSysEng:master Jul 24, 2019
@lucassaldanha lucassaldanha deleted the PAN-2723 branch July 24, 2019 20:35
rain-on pushed a commit to rain-on/pantheon that referenced this pull request Jul 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants