Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* Update cron-utils

Signed-off-by: Ashish Agrawal <ashisagr@amazon.com>
Signed-off-by: AWSHurneyt <hurneyt@amazon.com>
  • Loading branch information
lezzago authored and AWSHurneyt committed Mar 30, 2022
1 parent c16a683 commit ef77e2d
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ interface SecureTransportAction {
val resourceBackendRoles = resourceUser?.backendRoles
val requesterBackendRoles = requesterUser?.backendRoles

if (resourceBackendRoles == null || requesterBackendRoles == null || resourceBackendRoles.intersect(requesterBackendRoles).isEmpty()) {
if (
resourceBackendRoles == null ||
requesterBackendRoles == null ||
resourceBackendRoles.intersect(requesterBackendRoles).isEmpty()
) {
actionListener.onFailure(
AlertingException.wrap(
OpenSearchStatusException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -586,10 +586,16 @@ class MonitorRestApiIT : AlertingRestTestCase() {
val expectedAcknowledgedCount = alertsToAcknowledge.size

val acknowledgedAlerts = responseMap["success"] as List<String>
assertTrue("Expected $expectedAcknowledgedCount alerts to be acknowledged successfully.", acknowledgedAlerts.size == expectedAcknowledgedCount)
assertTrue(
"Expected $expectedAcknowledgedCount alerts to be acknowledged successfully.",
acknowledgedAlerts.size == expectedAcknowledgedCount
)

val acknowledgedAlertsList = acknowledgedAlerts.toString()
alertsToAcknowledge.forEach { alert -> assertTrue("Alert with ID ${alert.id} not found in failed list.", acknowledgedAlertsList.contains(alert.id)) }
alertsToAcknowledge.forEach {
alert ->
assertTrue("Alert with ID ${alert.id} not found in failed list.", acknowledgedAlertsList.contains(alert.id))
}

val failedResponse = responseMap["failed"] as List<String>
assertTrue("Expected 0 alerts to fail acknowledgment.", failedResponse.isEmpty())
Expand All @@ -604,7 +610,8 @@ class MonitorRestApiIT : AlertingRestTestCase() {

val alertsGroup2 = (1..15).map { createAlert(randomAlert(monitor).copy(state = Alert.State.ACTIVE)) }.toTypedArray()

val alertsToAcknowledge = arrayOf(*alertsGroup1, *alertsGroup2) // Creating an array of alerts that includes alerts that have been already acknowledged, and new alerts.
// Creating an array of alerts that includes alerts that have been already acknowledged, and new alerts.
val alertsToAcknowledge = arrayOf(*alertsGroup1, *alertsGroup2)

// WHEN
val response = acknowledgeAlerts(monitor, *alertsToAcknowledge)
Expand All @@ -614,18 +621,33 @@ class MonitorRestApiIT : AlertingRestTestCase() {
val expectedAcknowledgedCount = alertsToAcknowledge.size - alertsGroup1.size

val acknowledgedAlerts = responseMap["success"] as List<String>
assertTrue("Expected $expectedAcknowledgedCount alerts to be acknowledged successfully.", acknowledgedAlerts.size == expectedAcknowledgedCount)
assertTrue(
"Expected $expectedAcknowledgedCount alerts to be acknowledged successfully.",
acknowledgedAlerts.size == expectedAcknowledgedCount
)

val acknowledgedAlertsList = acknowledgedAlerts.toString()
alertsGroup2.forEach { alert -> assertTrue("Alert with ID ${alert.id} not found in failed list.", acknowledgedAlertsList.contains(alert.id)) }
alertsGroup1.forEach { alert -> assertFalse("Alert with ID ${alert.id} found in failed list.", acknowledgedAlertsList.contains(alert.id)) }
alertsGroup2.forEach {
alert ->
assertTrue("Alert with ID ${alert.id} not found in failed list.", acknowledgedAlertsList.contains(alert.id))
}
alertsGroup1.forEach {
alert ->
assertFalse("Alert with ID ${alert.id} found in failed list.", acknowledgedAlertsList.contains(alert.id))
}

val failedResponse = responseMap["failed"] as List<String>
assertTrue("Expected ${alertsGroup1.size} alerts to fail acknowledgment.", failedResponse.size == alertsGroup1.size)

val failedResponseList = failedResponse.toString()
alertsGroup1.forEach { alert -> assertTrue("Alert with ID ${alert.id} not found in failed list.", failedResponseList.contains(alert.id)) }
alertsGroup2.forEach { alert -> assertFalse("Alert with ID ${alert.id} found in failed list.", failedResponseList.contains(alert.id)) }
alertsGroup1.forEach {
alert ->
assertTrue("Alert with ID ${alert.id} not found in failed list.", failedResponseList.contains(alert.id))
}
alertsGroup2.forEach {
alert ->
assertFalse("Alert with ID ${alert.id} found in failed list.", failedResponseList.contains(alert.id))
}
}

@Throws(Exception::class)
Expand Down
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ allprojects {
compileKotlin.kotlinOptions.jvmTarget = compileTestKotlin.kotlinOptions.jvmTarget = "1.8"
compileKotlin.dependsOn ktlint
}

}

evaluationDependsOnChildren()
Expand Down
2 changes: 1 addition & 1 deletion core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}"
compile 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.1'
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlin_version}"
compile "com.cronutils:cron-utils:9.1.3"
compile "com.cronutils:cron-utils:9.1.6"
compile "org.opensearch.client:opensearch-rest-client:${opensearch_version}"
compile 'com.google.googlejavaformat:google-java-format:1.10.0'
compile "org.opensearch:common-utils:${common_utils_version}"
Expand Down

0 comments on commit ef77e2d

Please sign in to comment.