Skip to content

Commit

Permalink
Fix the flaky in allocation IT during multinode test (#983) (#989)
Browse files Browse the repository at this point in the history
(cherry picked from commit 502097e)

Signed-off-by: bowenlan-amzn <bowenlan23@gmail.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 093d4ee commit cbc45ed
Showing 1 changed file with 0 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class AllocationActionIT : IndexStateManagementRestTestCase() {
val states = listOf(
State("Allocate", listOf(actionConfig), listOf())
)

val policy = Policy(
id = policyID,
description = "$testIndexName description",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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])
}
Expand All @@ -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",
Expand Down Expand Up @@ -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])
}
Expand All @@ -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())
Expand Down Expand Up @@ -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])
}
Expand All @@ -218,7 +203,6 @@ class AllocationActionIT : IndexStateManagementRestTestCase() {
val states = listOf(
State("Allocate", listOf(actionConfig), listOf())
)

val policy = Policy(
id = policyID,
description = "$testIndexName description",
Expand Down

0 comments on commit cbc45ed

Please sign in to comment.