From 5a657aa8f014f48f3991393668393256eb612dbc Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Tue, 30 Apr 2024 14:19:01 -0700 Subject: [PATCH] Adjusted integ tests for when security is enabled. (#1528) (#1530) * Adjusted integ tests for when security is enabled. * Adjusted integ tests for when security is enabled. --------- (cherry picked from commit e7e77254501eff312e5948e5d9eb01e60ab058b9) Signed-off-by: AWSHurneyt Signed-off-by: github-actions[bot] Co-authored-by: github-actions[bot] --- .../alerting/transport/GetRemoteIndexesActionIT.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/alerting/src/test/kotlin/org/opensearch/alerting/transport/GetRemoteIndexesActionIT.kt b/alerting/src/test/kotlin/org/opensearch/alerting/transport/GetRemoteIndexesActionIT.kt index 99556fe3c..0b9282d10 100644 --- a/alerting/src/test/kotlin/org/opensearch/alerting/transport/GetRemoteIndexesActionIT.kt +++ b/alerting/src/test/kotlin/org/opensearch/alerting/transport/GetRemoteIndexesActionIT.kt @@ -101,7 +101,9 @@ class GetRemoteIndexesActionIT : AlertingRestTestCase() { assertNotNull(clusterDetails[ClusterIndexes.INDEXES_FIELD]) val indexes = clusterDetails[ClusterIndexes.INDEXES_FIELD] as Map> - assertEquals(expectedNames.size, indexes.keys.size) + + // Skipping this assert when security is enabled as it doesn't consider the existence of system indexes. + if (!securityEnabled()) assertEquals(expectedNames.size, indexes.keys.size) // Validate index-level response details expectedNames.forEach { indexName -> @@ -149,7 +151,9 @@ class GetRemoteIndexesActionIT : AlertingRestTestCase() { assertNotNull(clusterDetails[ClusterIndexes.INDEXES_FIELD]) val indexes = clusterDetails[ClusterIndexes.INDEXES_FIELD] as Map> - assertEquals(expectedNames.size, indexes.keys.size) + + // Skipping this assert when security is enabled as it doesn't consider the existence of system indexes. + if (!securityEnabled()) assertEquals(expectedNames.size, indexes.keys.size) // Validate index-level response details expectedNames.forEach { indexName -> @@ -197,7 +201,8 @@ class GetRemoteIndexesActionIT : AlertingRestTestCase() { assertNotNull(clusterDetails[ClusterIndexes.INDEXES_FIELD]) val indexes = clusterDetails[ClusterIndexes.INDEXES_FIELD] as Map> - assertEquals(expectedNames.size, indexes.keys.size) + // Skipping this assert when security is enabled as it doesn't consider the existence of system indexes. + if (!securityEnabled()) assertEquals(expectedNames.size, indexes.keys.size) // Validate index-level response details expectedNames.forEach { indexName ->