From 9983f1e538b5d12e73e67ec3a300519f2777953b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 30 Apr 2024 19:51:10 +0000 Subject: [PATCH] Adjusted integ tests for when security is enabled. (#1528) * Adjusted integ tests for when security is enabled. Signed-off-by: AWSHurneyt * Adjusted integ tests for when security is enabled. Signed-off-by: AWSHurneyt --------- Signed-off-by: AWSHurneyt (cherry picked from commit e7e77254501eff312e5948e5d9eb01e60ab058b9) Signed-off-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 ->