Skip to content

Commit

Permalink
Fixing flaky test org.opensearch.cluster.allocation.AwarenessAllocati…
Browse files Browse the repository at this point in the history
…onIT.testThreeZoneOneReplicaWithForceZoneValueAndLoadAwareness by adding dedicated cluster manager node

Signed-off-by: Rishab Nahata <[email protected]>
  • Loading branch information
imRishN committed Jun 22, 2022
1 parent 3dba46e commit 06b2acd
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -366,16 +366,19 @@ public void testThreeZoneOneReplicaWithForceZoneValueAndLoadAwareness() throws E
.put("cluster.routing.allocation.load_awareness.provisioned_capacity", Integer.toString(nodeCountPerAZ * 3))
.build();

logger.info("--> starting a dedicated cluster manager node");
internalCluster().startClusterManagerOnlyNode();

logger.info("--> starting 15 nodes on zones 'a' & 'b' & 'c'");
List<String> nodes_in_zone_a = internalCluster().startNodes(
List<String> nodes_in_zone_a = internalCluster().startDataOnlyNodes(
nodeCountPerAZ,
Settings.builder().put(commonSettings).put("node.attr.zone", "a").build()
);
List<String> nodes_in_zone_b = internalCluster().startNodes(
List<String> nodes_in_zone_b = internalCluster().startDataOnlyNodes(
nodeCountPerAZ,
Settings.builder().put(commonSettings).put("node.attr.zone", "b").build()
);
List<String> nodes_in_zone_c = internalCluster().startNodes(
List<String> nodes_in_zone_c = internalCluster().startDataOnlyNodes(
nodeCountPerAZ,
Settings.builder().put(commonSettings).put("node.attr.zone", "c").build()
);
Expand All @@ -395,7 +398,7 @@ public void testThreeZoneOneReplicaWithForceZoneValueAndLoadAwareness() throws E
.setIndices("test-1")
.setWaitForEvents(Priority.LANGUID)
.setWaitForGreenStatus()
.setWaitForNodes(Integer.toString(nodeCountPerAZ * 3))
.setWaitForNodes(Integer.toString(nodeCountPerAZ * 3 + 1))
.setWaitForNoRelocatingShards(true)
.setWaitForNoInitializingShards(true)
.execute()
Expand Down Expand Up @@ -431,7 +434,7 @@ public void testThreeZoneOneReplicaWithForceZoneValueAndLoadAwareness() throws E
.prepareHealth()
.setIndices("test-1")
.setWaitForEvents(Priority.LANGUID)
.setWaitForNodes(Integer.toString(nodeCountPerAZ * 3 - nodesToStop))
.setWaitForNodes(Integer.toString(nodeCountPerAZ * 3 - nodesToStop + 1))
.setWaitForNoRelocatingShards(true)
.setWaitForNoInitializingShards(true)
.execute()
Expand All @@ -452,7 +455,7 @@ public void testThreeZoneOneReplicaWithForceZoneValueAndLoadAwareness() throws E
.prepareHealth()
.setIndices("test-1", "test-2")
.setWaitForEvents(Priority.LANGUID)
.setWaitForNodes(Integer.toString(nodeCountPerAZ * 3 - nodesToStop))
.setWaitForNodes(Integer.toString(nodeCountPerAZ * 3 - nodesToStop + 1))
.setWaitForNoRelocatingShards(true)
.setWaitForNoInitializingShards(true)
.execute()
Expand All @@ -477,7 +480,7 @@ public void testThreeZoneOneReplicaWithForceZoneValueAndLoadAwareness() throws E
.prepareHealth()
.setIndices("test-1", "test-2")
.setWaitForEvents(Priority.LANGUID)
.setWaitForNodes(Integer.toString(nodeCountPerAZ * 3))
.setWaitForNodes(Integer.toString(nodeCountPerAZ * 3 + 1))
.setWaitForGreenStatus()
.setWaitForActiveShards(2 * numOfShards * (numOfReplica + 1))
.setWaitForNoRelocatingShards(true)
Expand Down

0 comments on commit 06b2acd

Please sign in to comment.