From 2ce04bcaaac902ff793d3edb005644cc425de3b3 Mon Sep 17 00:00:00 2001 From: Jacob Choi Date: Fri, 13 Oct 2023 21:08:52 -0400 Subject: [PATCH] changed booleanSupplier appropriately Signed-off-by: Jacob Choi --- .../alerting/resthandler/MonitorRestApiIT.kt | 16 ++++++++-------- .../DestinationMigrationUtilServiceIT.kt | 5 ++--- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/alerting/src/test/kotlin/org/opensearch/alerting/resthandler/MonitorRestApiIT.kt b/alerting/src/test/kotlin/org/opensearch/alerting/resthandler/MonitorRestApiIT.kt index a7bd4b7c1..72a12ed95 100644 --- a/alerting/src/test/kotlin/org/opensearch/alerting/resthandler/MonitorRestApiIT.kt +++ b/alerting/src/test/kotlin/org/opensearch/alerting/resthandler/MonitorRestApiIT.kt @@ -967,11 +967,11 @@ class MonitorRestApiIT : AlertingRestTestCase() { fun `test monitor stats when disabling and re-enabling scheduled jobs with existing monitor`() { // Enable Monitor jobs - var response = enableScheduledJob() + enableScheduledJob() val monitorId = createMonitor(randomQueryLevelMonitor(enabled = true), refresh = true).id if (isMultiNode) OpenSearchTestCase.waitUntil({ - return@waitUntil (response == null) + return@waitUntil false }, 2, TimeUnit.SECONDS) var alertingStats = getAlertingStats() assertAlertingStatsSweeperEnabled(alertingStats, true) @@ -1002,11 +1002,11 @@ class MonitorRestApiIT : AlertingRestTestCase() { ) // Re-enable Monitor jobs - response = enableScheduledJob() + enableScheduledJob() // Sleep briefly so sweep can reschedule the Monitor OpenSearchTestCase.waitUntil({ - return@waitUntil (response == null) + return@waitUntil false }, 2, TimeUnit.SECONDS) alertingStats = getAlertingStats() @@ -1031,11 +1031,11 @@ class MonitorRestApiIT : AlertingRestTestCase() { fun `test monitor stats jobs`() { // Enable the Monitor plugin. - var response = enableScheduledJob() + enableScheduledJob() createRandomMonitor(refresh = true) if (isMultiNode) OpenSearchTestCase.waitUntil({ - return@waitUntil (response == null) + return@waitUntil false }, 2, TimeUnit.SECONDS) val responseMap = getAlertingStats() assertAlertingStatsSweeperEnabled(responseMap, true) @@ -1066,11 +1066,11 @@ class MonitorRestApiIT : AlertingRestTestCase() { fun `test monitor specific metric`() { // Enable the Monitor plugin. - var response = enableScheduledJob() + enableScheduledJob() createRandomMonitor(refresh = true) if (isMultiNode) OpenSearchTestCase.waitUntil({ - return@waitUntil (response == null) + return@waitUntil false }, 2, TimeUnit.SECONDS) val responseMap = getAlertingStats("/jobs_info") assertAlertingStatsSweeperEnabled(responseMap, true) diff --git a/alerting/src/test/kotlin/org/opensearch/alerting/util/destinationmigration/DestinationMigrationUtilServiceIT.kt b/alerting/src/test/kotlin/org/opensearch/alerting/util/destinationmigration/DestinationMigrationUtilServiceIT.kt index 67093af78..903eedb44 100644 --- a/alerting/src/test/kotlin/org/opensearch/alerting/util/destinationmigration/DestinationMigrationUtilServiceIT.kt +++ b/alerting/src/test/kotlin/org/opensearch/alerting/util/destinationmigration/DestinationMigrationUtilServiceIT.kt @@ -81,10 +81,9 @@ class DestinationMigrationUtilServiceIT : AlertingRestTestCase() { } // Create cluster change event and wait for migration service to complete migrating data over - var request: Map? = null - request = client().updateSettings("indices.recovery.max_bytes_per_sec", "40mb") + client().updateSettings("indices.recovery.max_bytes_per_sec", "40mb") OpenSearchTestCase.waitUntil({ - return@waitUntil request == null + return@waitUntil false }, 2, TimeUnit.MINUTES) for (id in ids) {