From ad1d7653789c06c7428b5f7e99ae12b51ed6164d Mon Sep 17 00:00:00 2001 From: Joshua Au Date: Sat, 30 Dec 2023 01:03:09 -0800 Subject: [PATCH] Sleep thread to allow jobs to finish Signed-off-by: Joshua Au --- .../IndexStateManagementRestTestCase.kt | 2 -- .../indexstatemanagement/resthandler/RestExplainActionIT.kt | 6 ++++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/test/kotlin/org/opensearch/indexmanagement/indexstatemanagement/IndexStateManagementRestTestCase.kt b/src/test/kotlin/org/opensearch/indexmanagement/indexstatemanagement/IndexStateManagementRestTestCase.kt index ddb510488..ab8e772a2 100644 --- a/src/test/kotlin/org/opensearch/indexmanagement/indexstatemanagement/IndexStateManagementRestTestCase.kt +++ b/src/test/kotlin/org/opensearch/indexmanagement/indexstatemanagement/IndexStateManagementRestTestCase.kt @@ -476,8 +476,6 @@ abstract class IndexStateManagementRestTestCase : IndexManagementRestTestCase() protected fun ExplainFilter.toHttpEntity(): HttpEntity = StringEntity(toJsonString(), APPLICATION_JSON) - protected fun ExplainFilter.toHttpEntity(): HttpEntity = StringEntity(toJsonString(), ContentType.APPLICATION_JSON) - protected fun ChangePolicy.toHttpEntity(): HttpEntity { var string = "{\"${ChangePolicy.POLICY_ID_FIELD}\":\"$policyID\"," if (state != null) { diff --git a/src/test/kotlin/org/opensearch/indexmanagement/indexstatemanagement/resthandler/RestExplainActionIT.kt b/src/test/kotlin/org/opensearch/indexmanagement/indexstatemanagement/resthandler/RestExplainActionIT.kt index 5c91f9364..c0842adbf 100644 --- a/src/test/kotlin/org/opensearch/indexmanagement/indexstatemanagement/resthandler/RestExplainActionIT.kt +++ b/src/test/kotlin/org/opensearch/indexmanagement/indexstatemanagement/resthandler/RestExplainActionIT.kt @@ -500,6 +500,9 @@ class RestExplainActionIT : IndexStateManagementRestTestCase() { removePolicyFromIndex(indexName1) removePolicyFromIndex(indexName2) + + // wait for job to finish + Thread.sleep(1000) } fun `test explain filter failed index`() { @@ -607,6 +610,9 @@ class RestExplainActionIT : IndexStateManagementRestTestCase() { removePolicyFromIndex(indexName1) removePolicyFromIndex(indexName2) + + // wait for job to finish + Thread.sleep(1000) } @Suppress("UNCHECKED_CAST") // Do assertion of the response map here so we don't have many places to do suppression.