From f42cede7ec2fce650225eaf12de2eaa8622484ac Mon Sep 17 00:00:00 2001 From: bowenlan-amzn Date: Wed, 24 May 2023 12:12:18 -0700 Subject: [PATCH] Fix tests Signed-off-by: bowenlan-amzn --- .../indexmanagement/IndexManagementRestTestCase.kt | 5 +++++ .../rollup/resthandler/RestStopRollupActionIT.kt | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/test/kotlin/org/opensearch/indexmanagement/IndexManagementRestTestCase.kt b/src/test/kotlin/org/opensearch/indexmanagement/IndexManagementRestTestCase.kt index 4162f9964..cdccdbab7 100644 --- a/src/test/kotlin/org/opensearch/indexmanagement/IndexManagementRestTestCase.kt +++ b/src/test/kotlin/org/opensearch/indexmanagement/IndexManagementRestTestCase.kt @@ -77,6 +77,11 @@ abstract class IndexManagementRestTestCase : ODFERestTestCase() { protected fun Response.restStatus(): RestStatus = RestStatus.fromCode(this.statusLine.statusCode) + protected fun indexExists(index: String): Boolean { + val response = client().makeRequest("HEAD", index) + return RestStatus.OK == response.restStatus() + } + protected fun assertIndexExists(index: String) { val response = client().makeRequest("HEAD", index) assertEquals("Index $index does not exist.", RestStatus.OK, response.restStatus()) diff --git a/src/test/kotlin/org/opensearch/indexmanagement/rollup/resthandler/RestStopRollupActionIT.kt b/src/test/kotlin/org/opensearch/indexmanagement/rollup/resthandler/RestStopRollupActionIT.kt index e29b55a15..95d28756a 100644 --- a/src/test/kotlin/org/opensearch/indexmanagement/rollup/resthandler/RestStopRollupActionIT.kt +++ b/src/test/kotlin/org/opensearch/indexmanagement/rollup/resthandler/RestStopRollupActionIT.kt @@ -310,6 +310,8 @@ class RestStopRollupActionIT : RollupRestTestCase() { assertEquals("Rollup is not STOPPED", RollupMetadata.Status.STOPPED, rollupMetadata.status) // clearing the config index to prevent other tests using this multi shard index + Thread.sleep(2000L) deleteIndex(IndexManagementPlugin.INDEX_MANAGEMENT_INDEX) + Thread.sleep(2000L) } }