Skip to content

Commit

Permalink
Fixed cron schedule expression for flaky explain IT
Browse files Browse the repository at this point in the history
Signed-off-by: bowenlan-amzn <[email protected]>
  • Loading branch information
bowenlan-amzn committed Jun 16, 2022
1 parent 32a4f25 commit b6e2fbd
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import org.opensearch.indexmanagement.snapshotmanagement.model.SMMetadata.Workfl
import org.opensearch.indexmanagement.snapshotmanagement.model.SMPolicy
import org.opensearch.indexmanagement.snapshotmanagement.randomSMPolicy
import org.opensearch.indexmanagement.waitFor
import org.opensearch.jobscheduler.spi.schedule.CronSchedule
import org.opensearch.jobscheduler.spi.schedule.IntervalSchedule
import org.opensearch.rest.RestStatus
import java.time.Instant.now
Expand Down Expand Up @@ -66,7 +67,12 @@ class RestExplainSnapshotManagementIT : SnapshotManagementRestTestCase() {
}

fun `test explain all with list of policy names`() {
val smPolicies = randomList(2, 3) { createSMPolicy(randomSMPolicy(jobEnabled = true)) }
// TODO flaky there are some type of random cron schedule that will cause nextExecutionTime to return null
val smPolicies = randomList(2, 3) { createSMPolicy(randomSMPolicy(
jobEnabled = true,
creationSchedule = CronSchedule("* * * * *", randomZone()),
deletionSchedule = CronSchedule("* * * * *", randomZone()),
)) }
// if this proves to be flaky, just index the metadata directly instead of executing to generate metadata
smPolicies.forEach { updateSMPolicyStartTime(it) }
waitFor {
Expand All @@ -88,7 +94,12 @@ class RestExplainSnapshotManagementIT : SnapshotManagementRestTestCase() {
}

fun `test explain all with empty policy name`() {
val smPolicies = randomList(2, 3) { createSMPolicy(randomSMPolicy(jobEnabled = true)) }
// TODO flaky there are some type of random cron schedule that will cause nextExecutionTime to return null
val smPolicies = randomList(2, 3) { createSMPolicy(randomSMPolicy(
jobEnabled = true,
creationSchedule = CronSchedule("* * * * *", randomZone()),
deletionSchedule = CronSchedule("* * * * *", randomZone()),
)) }
// if this proves to be flaky, just index the metadata directly instead of executing to generate metadata
smPolicies.forEach { updateSMPolicyStartTime(it) }
waitFor {
Expand Down

0 comments on commit b6e2fbd

Please sign in to comment.