Skip to content

Commit

Permalink
using verifyMonitorStats to enhance the test efficiency
Browse files Browse the repository at this point in the history
Signed-off-by: Jacob Choi <[email protected]>
  • Loading branch information
JacobCho-i committed Nov 10, 2023
1 parent 19e5ded commit 0a75b05
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,21 @@ class AlertingBackwardsCompatibilityIT : AlertingRestTestCase() {
// the test execution by a lot (might have to wait for Job Scheduler plugin integration first)
// Waiting a minute to ensure the Monitor ran again at least once before checking if the job is running
// on time
var passed = false
OpenSearchTestCase.waitUntil({
return@waitUntil false
try {
// Run verifyMonitorStats until all assertion test passes
verifyMonitorStats("/_plugins/_alerting")
passed = true
return@waitUntil true
} catch (e: AssertionError) {
return@waitUntil false
}
}, 1, TimeUnit.MINUTES)
verifyMonitorStats("/_plugins/_alerting")
if (!passed) {
// if it hit the max time (1 minute), run verifyMonitorStats again to make sure all the tests pass
verifyMonitorStats("/_plugins/_alerting")
}
}
}
break
Expand Down

0 comments on commit 0a75b05

Please sign in to comment.