diff --git a/server/src/test/java/org/opensearch/cluster/routing/allocation/IndexShardHotSpotTests.java b/server/src/test/java/org/opensearch/cluster/routing/allocation/IndexShardHotSpotTests.java index 875432c9e6e..2efbb256e36 100644 --- a/server/src/test/java/org/opensearch/cluster/routing/allocation/IndexShardHotSpotTests.java +++ b/server/src/test/java/org/opensearch/cluster/routing/allocation/IndexShardHotSpotTests.java @@ -20,14 +20,7 @@ public class IndexShardHotSpotTests extends OpenSearchAllocationWithConstraintsT terminateNodes("node_1"); assertForIndexShardHotSpots(false, 4); addNodesWithoutIndexing(1, "new_node_"); - int movesForModeNone = allocateAndCheckIndexShardHotSpots(false, 5, "new_node_0"); - - setupInitialCluster(5, 1, 5, 1); - terminateNodes("node_1"); - assertForIndexShardHotSpots(false, 4); - addNodesWithoutIndexing(1, "new_node_"); - int movesForModeUnassigned = allocateAndCheckIndexShardHotSpots(false, 5, "new_node_0"); - assertTrue(movesForModeUnassigned <= movesForModeNone); + allocateAndCheckIndexShardHotSpots(false, 5, "new_node_0"); } /** @@ -39,15 +32,7 @@ public class IndexShardHotSpotTests extends OpenSearchAllocationWithConstraintsT terminateNodes("node_1"); assertForIndexShardHotSpots(false, 4); addNodesWithIndexing(1, "new_node_", 3, 20, 1); - int movesForModeNone = allocateAndCheckIndexShardHotSpots(false, 5, "new_node_0"); - - resetCluster(); - buildAllocationService(); - terminateNodes("node_1"); - assertForIndexShardHotSpots(false, 4); - addNodesWithIndexing(1, "new_node_", 3, 20, 1); - int movesForModeUnassigned = allocateAndCheckIndexShardHotSpots(false, 5, "new_node_0"); - assertTrue(movesForModeUnassigned <= movesForModeNone); + allocateAndCheckIndexShardHotSpots(false, 5, "new_node_0"); } /** @@ -57,32 +42,17 @@ public class IndexShardHotSpotTests extends OpenSearchAllocationWithConstraintsT setupInitialCluster(3, 30, 10, 1); buildAllocationService(); addNodesWithIndexing(1, "new_node_", 8, 10, 1); - int movesForModeNone = allocateAndCheckIndexShardHotSpots(false, 4, "new_node_0"); - - resetCluster(); - buildAllocationService(); - addNodesWithIndexing(1, "new_node_", 8, 10, 1); - int movesForModeUnassigned = allocateAndCheckIndexShardHotSpots(false, 4, "new_node_0"); - assertTrue(movesForModeUnassigned <= movesForModeNone); + allocateAndCheckIndexShardHotSpots(false, 4, "new_node_0"); } /** * Test under replicated yellow cluster scale out to green. - * - * This scenario is not expected to create hotspots even without constraints enabled. The - * test is a sanity check to ensure allocation constraints don't worsen the situation. */ public void testUnderReplicatedClusterScaleOut() { setupInitialCluster(3, 30, 10, 3); buildAllocationService(); addNodesWithoutIndexing(1, "new_node_"); - int movesForModeNone = allocateAndCheckIndexShardHotSpots(false, 4, "new_node_0"); - - resetCluster(); - buildAllocationService(); - addNodesWithoutIndexing(1, "new_node_"); - int movesForModeUnassigned = allocateAndCheckIndexShardHotSpots(false, 4, "new_node_0"); - assertTrue(movesForModeUnassigned <= movesForModeNone); + allocateAndCheckIndexShardHotSpots(false, 4, "new_node_0"); } /** @@ -91,19 +61,12 @@ public class IndexShardHotSpotTests extends OpenSearchAllocationWithConstraintsT * * During moveShards(), shards are picked from across indexes in an interleaved manner. * This prevents hot spots by evenly picking up shards. Since shard order can change - * in subsequent runs, we are not guaranteed to less moves than no allocation constraint run. - * - * Move tests are hence just a sanity test, to ensure we don't create any unexpected hot spots with - * allocation settings. + * in subsequent runs. */ public void testClusterScaleIn() { setupInitialCluster(4, 30, 10, 1); buildAllocationService("node_0,node_1"); allocateAndCheckIndexShardHotSpots(false, 2, "node_2", "node_3"); - - resetCluster(); - buildAllocationService("node_0,node_1"); - allocateAndCheckIndexShardHotSpots(false, 2, "node_2", "node_3"); } /** @@ -115,10 +78,5 @@ public class IndexShardHotSpotTests extends OpenSearchAllocationWithConstraintsT buildAllocationService("node_0,node_1"); addNodesWithoutIndexing(1, "new_node_"); allocateAndCheckIndexShardHotSpots(false, 3, "node_2", "node_3", "new_node_0"); - - resetCluster(); - buildAllocationService("node_0,node_1"); - addNodesWithoutIndexing(1, "new_node_"); - allocateAndCheckIndexShardHotSpots(false, 3, "node_2", "node_3", "new_node_0"); } }