Skip to content

Commit

Permalink
Fix spotless check
Browse files Browse the repository at this point in the history
Signed-off-by: Rishab Nahata <rnnahata@amazon.com>
  • Loading branch information
imRishN committed Oct 7, 2022
1 parent 4a932b7 commit 05d073e
Showing 1 changed file with 26 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -786,8 +786,10 @@ public void testJoinFailsWhenDecommissioned() {
long initialVersion = randomLongBetween(1, 10);
setupFakeClusterManagerServiceAndCoordinator(
initialTerm,
initialStateWithDecommissionedAttribute(initialState(node0, initialTerm, initialVersion, VotingConfiguration.of(node0)),
new DecommissionAttribute("zone", "zone1")),
initialStateWithDecommissionedAttribute(
initialState(node0, initialTerm, initialVersion, VotingConfiguration.of(node0)),
new DecommissionAttribute("zone", "zone1")
),
() -> new StatusInfo(HEALTHY, "healthy-info")
);
assertFalse(isLocalNodeElectedMaster());
Expand All @@ -799,20 +801,32 @@ public void testJoinFailsWhenDecommissioned() {
assertTrue(isLocalNodeElectedMaster());
assertTrue(clusterStateHasNode(node1));
DiscoveryNode decommissionedNode = new DiscoveryNode(
"data_2", 2 + "",
buildNewFakeTransportAddress(), Collections.singletonMap("zone", "zone1"), DiscoveryNodeRole.BUILT_IN_ROLES, Version.CURRENT);
"data_2",
2 + "",
buildNewFakeTransportAddress(),
Collections.singletonMap("zone", "zone1"),
DiscoveryNodeRole.BUILT_IN_ROLES,
Version.CURRENT
);
long anotherTerm = newTerm + randomLongBetween(1, 10);

assertThat(
expectThrows(NodeDecommissionedException.class, () -> joinNodeAndRun(new JoinRequest(decommissionedNode, anotherTerm, Optional.empty())))
.getMessage(),
expectThrows(
NodeDecommissionedException.class,
() -> joinNodeAndRun(new JoinRequest(decommissionedNode, anotherTerm, Optional.empty()))
).getMessage(),
containsString("with current status of decommissioning")
);
assertFalse(clusterStateHasNode(decommissionedNode));

DiscoveryNode node3 = new DiscoveryNode(
"data_3", 3 + "",
buildNewFakeTransportAddress(), Collections.singletonMap("zone", "zone2"), DiscoveryNodeRole.BUILT_IN_ROLES, Version.CURRENT);
"data_3",
3 + "",
buildNewFakeTransportAddress(),
Collections.singletonMap("zone", "zone2"),
DiscoveryNodeRole.BUILT_IN_ROLES,
Version.CURRENT
);
long termForNode3 = anotherTerm + randomLongBetween(1, 10);

joinNodeAndRun(new JoinRequest(node3, termForNode3, Optional.empty()));
Expand All @@ -827,7 +841,10 @@ private boolean clusterStateHasNode(DiscoveryNode node) {
return node.equals(MasterServiceTests.discoveryState(clusterManagerService).nodes().get(node.getId()));
}

private static ClusterState initialStateWithDecommissionedAttribute(ClusterState clusterState, DecommissionAttribute decommissionAttribute) {
private static ClusterState initialStateWithDecommissionedAttribute(
ClusterState clusterState,
DecommissionAttribute decommissionAttribute
) {
DecommissionAttributeMetadata decommissionAttributeMetadata = new DecommissionAttributeMetadata(
decommissionAttribute,
DecommissionStatus.SUCCESSFUL
Expand Down

0 comments on commit 05d073e

Please sign in to comment.