From 19e5ded8669eaed7d9fe69151fcbf4733f379799 Mon Sep 17 00:00:00 2001 From: Jacob Choi Date: Tue, 31 Oct 2023 22:34:40 -0400 Subject: [PATCH] fixing boolean supplier correctly Signed-off-by: Jacob Choi --- .../org/opensearch/alerting/MonitorRunnerServiceIT.kt | 2 +- .../org/opensearch/alerting/resthandler/MonitorRestApiIT.kt | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/alerting/src/test/kotlin/org/opensearch/alerting/MonitorRunnerServiceIT.kt b/alerting/src/test/kotlin/org/opensearch/alerting/MonitorRunnerServiceIT.kt index 42060e506..27a653d5f 100644 --- a/alerting/src/test/kotlin/org/opensearch/alerting/MonitorRunnerServiceIT.kt +++ b/alerting/src/test/kotlin/org/opensearch/alerting/MonitorRunnerServiceIT.kt @@ -1429,7 +1429,7 @@ class MonitorRunnerServiceIT : AlertingRestTestCase() { // Execute Monitor and check that both Alerts were updated OpenSearchTestCase.waitUntil({ - return@waitUntil (searchAlerts(monitor, AlertIndices.ALL_ALERT_INDEX_PATTERN).size == 2) + return@waitUntil false }, 200, TimeUnit.MILLISECONDS) executeMonitor(monitor.id) currentAlerts = searchAlerts(monitor, AlertIndices.ALL_ALERT_INDEX_PATTERN) 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 72a12ed95..25e8d319d 100644 --- a/alerting/src/test/kotlin/org/opensearch/alerting/resthandler/MonitorRestApiIT.kt +++ b/alerting/src/test/kotlin/org/opensearch/alerting/resthandler/MonitorRestApiIT.kt @@ -812,8 +812,9 @@ class MonitorRestApiIT : AlertingRestTestCase() { // Wait 5 seconds for event to be processed and alerts moved OpenSearchTestCase.waitUntil({ + val alerts = searchAlerts(monitor) val historyAlerts = searchAlerts(monitor, AlertIndices.ALERT_HISTORY_WRITE_INDEX) - return@waitUntil (historyAlerts.size == 1) + return@waitUntil (alerts.isEmpty() && historyAlerts.size == 1) }, 5, TimeUnit.SECONDS) val alerts = searchAlerts(monitor) @@ -846,8 +847,7 @@ class MonitorRestApiIT : AlertingRestTestCase() { // Wait 5 seconds for event to be processed and alerts moved OpenSearchTestCase.waitUntil({ - val historyAlerts = searchAlerts(monitor, AlertIndices.ALERT_HISTORY_WRITE_INDEX) - return@waitUntil (historyAlerts.size == 1) + return@waitUntil false }, 5, TimeUnit.SECONDS) val alerts = searchAlerts(monitor)