From 3c88de0d5a66fab38c5c64dcf853192a8bbbccd6 Mon Sep 17 00:00:00 2001 From: Amardeepsingh Siglani Date: Tue, 24 Sep 2024 22:48:29 -0700 Subject: [PATCH] fixed integ tests Signed-off-by: Amardeepsingh Siglani --- .../notifications/core/destinations/ChimeDestinationTests.kt | 2 ++ .../core/destinations/CustomWebhookDestinationTests.kt | 2 ++ .../core/destinations/MicrosoftTeamsDestinationTests.kt | 2 ++ .../notifications/core/destinations/SlackDestinationTests.kt | 2 ++ 4 files changed, 8 insertions(+) diff --git a/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/ChimeDestinationTests.kt b/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/ChimeDestinationTests.kt index 1ef6fa99..af42ed58 100644 --- a/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/ChimeDestinationTests.kt +++ b/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/ChimeDestinationTests.kt @@ -5,6 +5,7 @@ package org.opensearch.notifications.core.destinations +import inet.ipaddr.IPAddressString import io.mockk.every import io.mockk.mockk import io.mockk.mockkStatic @@ -50,6 +51,7 @@ internal class ChimeDestinationTests { // Stubbing isHostInDenylist() so it doesn't attempt to resolve hosts that don't exist in the unit tests mockkStatic("org.opensearch.notifications.spi.utils.ValidationHelpersKt") every { org.opensearch.notifications.spi.utils.isHostInDenylist(any(), any()) } returns false + every { org.opensearch.notifications.spi.utils.getResolvedIps(any()) } returns listOf(IPAddressString("174.0.0.0")) } @Test diff --git a/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/CustomWebhookDestinationTests.kt b/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/CustomWebhookDestinationTests.kt index 26aac9e8..fcce063d 100644 --- a/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/CustomWebhookDestinationTests.kt +++ b/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/CustomWebhookDestinationTests.kt @@ -5,6 +5,7 @@ package org.opensearch.notifications.core.destinations +import inet.ipaddr.IPAddressString import io.mockk.every import io.mockk.mockk import io.mockk.mockkStatic @@ -62,6 +63,7 @@ internal class CustomWebhookDestinationTests { // Stubbing isHostInDenylist() so it doesn't attempt to resolve hosts that don't exist in the unit tests mockkStatic("org.opensearch.notifications.spi.utils.ValidationHelpersKt") every { org.opensearch.notifications.spi.utils.isHostInDenylist(any(), any()) } returns false + every { org.opensearch.notifications.spi.utils.getResolvedIps(any()) } returns listOf(IPAddressString("174.0.0.0")) } @ParameterizedTest(name = "method {0} should return corresponding type of Http request object {1}") diff --git a/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/MicrosoftTeamsDestinationTests.kt b/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/MicrosoftTeamsDestinationTests.kt index 54ec06c5..464a050d 100644 --- a/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/MicrosoftTeamsDestinationTests.kt +++ b/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/MicrosoftTeamsDestinationTests.kt @@ -5,6 +5,7 @@ package org.opensearch.notifications.core.destinations +import inet.ipaddr.IPAddressString import io.mockk.every import io.mockk.mockk import io.mockk.mockkStatic @@ -52,6 +53,7 @@ internal class MicrosoftTeamsDestinationTests { // Stubbing isHostInDenylist() so it doesn't attempt to resolve hosts that don't exist in the unit tests mockkStatic("org.opensearch.notifications.spi.utils.ValidationHelpersKt") every { org.opensearch.notifications.spi.utils.isHostInDenylist(any(), any()) } returns false + every { org.opensearch.notifications.spi.utils.getResolvedIps(any()) } returns listOf(IPAddressString("174.0.0.0")) } @Test diff --git a/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/SlackDestinationTests.kt b/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/SlackDestinationTests.kt index 0175bf06..a010cac7 100644 --- a/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/SlackDestinationTests.kt +++ b/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/SlackDestinationTests.kt @@ -5,6 +5,7 @@ package org.opensearch.notifications.core.destinations +import inet.ipaddr.IPAddressString import io.mockk.every import io.mockk.mockk import io.mockk.mockkStatic @@ -52,6 +53,7 @@ internal class SlackDestinationTests { // Stubbing isHostInDenylist() so it doesn't attempt to resolve hosts that don't exist in the unit tests mockkStatic("org.opensearch.notifications.spi.utils.ValidationHelpersKt") every { org.opensearch.notifications.spi.utils.isHostInDenylist(any(), any()) } returns false + every { org.opensearch.notifications.spi.utils.getResolvedIps(any()) } returns listOf(IPAddressString("174.0.0.0")) } @Test