From cbc45ed93da63d8068c9e3bb8786c8404d88ad05 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Thu, 5 Oct 2023 16:48:50 -0700 Subject: [PATCH] Fix the flaky in allocation IT during multinode test (#983) (#989) (cherry picked from commit 502097e0e9d00d5b244ca9468d732502f048b38c) Signed-off-by: bowenlan-amzn Signed-off-by: github-actions[bot] Co-authored-by: github-actions[bot] --- .../action/AllocationActionIT.kt | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/test/kotlin/org/opensearch/indexmanagement/indexstatemanagement/action/AllocationActionIT.kt b/src/test/kotlin/org/opensearch/indexmanagement/indexstatemanagement/action/AllocationActionIT.kt index 82b8daddf..63b00200a 100644 --- a/src/test/kotlin/org/opensearch/indexmanagement/indexstatemanagement/action/AllocationActionIT.kt +++ b/src/test/kotlin/org/opensearch/indexmanagement/indexstatemanagement/action/AllocationActionIT.kt @@ -26,7 +26,6 @@ class AllocationActionIT : IndexStateManagementRestTestCase() { val states = listOf( State("Allocate", listOf(actionConfig), listOf()) ) - val policy = Policy( id = policyID, description = "$testIndexName description", @@ -66,12 +65,10 @@ class AllocationActionIT : IndexStateManagementRestTestCase() { createIndex(indexName, null, null, "0") availableNodes.remove(getIndexShardNodes(indexName)[0]) - val actionConfig = AllocationAction(require = mapOf("_name" to availableNodes.first()), exclude = emptyMap(), include = emptyMap(), index = 0) val states = listOf( State("Allocate", listOf(actionConfig), listOf()) ) - val policy = Policy( id = policyID, description = "$testIndexName description", @@ -100,9 +97,6 @@ class AllocationActionIT : IndexStateManagementRestTestCase() { assertEquals(actionConfig.require["_name"], settings["index.routing.allocation.require._name"]) } - // Third execution: Waits for allocation to complete, which will happen in this execution since index is small - updateManagedIndexConfigStartTime(managedIndexConfig) - waitFor { assertEquals(availableNodes.first(), getIndexShardNodes(indexName)[0]) } @@ -117,12 +111,10 @@ class AllocationActionIT : IndexStateManagementRestTestCase() { createIndex(indexName, null, null, "0") val excludedNode = getIndexShardNodes(indexName)[0].toString() - val actionConfig = AllocationAction(require = emptyMap(), exclude = mapOf("_name" to excludedNode), include = emptyMap(), index = 0) val states = listOf( State("Allocate", listOf(actionConfig), listOf()) ) - val policy = Policy( id = policyID, description = "$testIndexName description", @@ -151,9 +143,6 @@ class AllocationActionIT : IndexStateManagementRestTestCase() { assertEquals(actionConfig.exclude["_name"], settings["index.routing.allocation.exclude._name"]) } - // Third execution: Waits for allocation to complete, which will happen in this execution since index is small - updateManagedIndexConfigStartTime(managedIndexConfig) - waitFor { assertNotEquals(excludedNode, getIndexShardNodes(indexName)[0]) } @@ -169,7 +158,6 @@ class AllocationActionIT : IndexStateManagementRestTestCase() { createIndex(indexName, null, null, "0") availableNodes.remove(getIndexShardNodes(indexName)[0]) - val actionConfig = AllocationAction(require = emptyMap(), exclude = emptyMap(), include = mapOf("_name" to availableNodes.first()), index = 0) val states = listOf( State("Allocate", listOf(actionConfig), listOf()) @@ -203,9 +191,6 @@ class AllocationActionIT : IndexStateManagementRestTestCase() { assertEquals(actionConfig.include["_name"], settings["index.routing.allocation.include._name"]) } - // Third execution: Waits for allocation to complete, which will happen in this execution since index is small - updateManagedIndexConfigStartTime(managedIndexConfig) - waitFor { assertEquals(availableNodes.first(), getIndexShardNodes(indexName)[0]) } @@ -218,7 +203,6 @@ class AllocationActionIT : IndexStateManagementRestTestCase() { val states = listOf( State("Allocate", listOf(actionConfig), listOf()) ) - val policy = Policy( id = policyID, description = "$testIndexName description",