From 8c1e618284965b91e170b237979732e919b62589 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Mon, 3 Jul 2023 19:13:46 +0800 Subject: [PATCH] remove runtime notification settings (#839) (#843) Signed-off-by: Hailong Cui (cherry picked from commit 2a9bcd682e9cb63253e7a8478be881e046fa43ef) Co-authored-by: Hailong Cui Signed-off-by: Ronnak Saxena --- .../filter/NotificationActionListener.kt | 7 +- .../filter/NotificationActionListenerIT.kt | 115 ++++++++++++------ 2 files changed, 82 insertions(+), 40 deletions(-) diff --git a/src/main/kotlin/org/opensearch/indexmanagement/controlcenter/notification/filter/NotificationActionListener.kt b/src/main/kotlin/org/opensearch/indexmanagement/controlcenter/notification/filter/NotificationActionListener.kt index cf44441fe..81411165c 100644 --- a/src/main/kotlin/org/opensearch/indexmanagement/controlcenter/notification/filter/NotificationActionListener.kt +++ b/src/main/kotlin/org/opensearch/indexmanagement/controlcenter/notification/filter/NotificationActionListener.kt @@ -235,9 +235,12 @@ class NotificationActionListener>> + )["hits"]!!["total"]!!["value"] + ) + + try { + client.makeRequest("GET", "_plugins/_im/lron/LRON:$taskId") + } catch (e: ResponseException) { + // runtime policy been removed + Assert.assertTrue(e.response.restStatus() == RestStatus.NOT_FOUND) + } + } + } + + private fun performReindex(): Response { + insertSampleData("source-index", 10) + createIndex("reindex-dest", Settings.EMPTY) + + val response = client.makeRequest( + "POST", "_reindex?wait_for_completion=false", + StringEntity( + """ + { + "source": { + "index": "source-index" + }, + "dest": { + "index": "reindex-dest" + } + } + """.trimIndent(), + ContentType.APPLICATION_JSON + ) + ) + return response + } }