From 1fc05e34196930e973800f0b5b7da85e0c6d9f9b Mon Sep 17 00:00:00 2001 From: monusingh-1 Date: Thu, 17 Aug 2023 11:57:57 +0530 Subject: [PATCH] Added comments for skipped tests Signed-off-by: monusingh-1 --- .../replication/ReplicationHelpers.kt | 3 ++ .../integ/rest/ClusterRerouteFollowerIT.kt | 8 ++--- .../integ/rest/ClusterRerouteLeaderIT.kt | 8 ++--- .../integ/rest/ResumeReplicationIT.kt | 21 +++---------- .../integ/rest/StartReplicationIT.kt | 30 +++++-------------- .../integ/rest/StopReplicationIT.kt | 12 ++------ 6 files changed, 20 insertions(+), 62 deletions(-) diff --git a/src/test/kotlin/org/opensearch/replication/ReplicationHelpers.kt b/src/test/kotlin/org/opensearch/replication/ReplicationHelpers.kt index 2d42a0d21..f695a2ad5 100644 --- a/src/test/kotlin/org/opensearch/replication/ReplicationHelpers.kt +++ b/src/test/kotlin/org/opensearch/replication/ReplicationHelpers.kt @@ -55,6 +55,9 @@ const val INDEX_TASK_CANCELLATION_REASON = "AutoPaused: Index replication task w const val STATUS_REASON_USER_INITIATED = "User initiated" const val STATUS_REASON_SHARD_TASK_CANCELLED = "Shard task killed or cancelled." const val STATUS_REASON_INDEX_NOT_FOUND = "no such index" +const val ANALYZERS_NOT_ACCESSIBLE_FOR_REMOTE_DOMAINS = "Analysers are not accessible when run on remote clusters." +const val SNAPSHOTS_NOT_ACCESSIBLE_FOR_REMOTE_DOMAINS = "Snapshots are not accessible when run on remote clusters." +const val REROUTE_TESTS_NOT_ELIGIBLE_FOR_SINGLE_NODE_CLUSTER = "Reroute not eligible for single node clusters" fun RestHighLevelClient.startReplication(request: StartReplicationRequest, diff --git a/src/test/kotlin/org/opensearch/replication/integ/rest/ClusterRerouteFollowerIT.kt b/src/test/kotlin/org/opensearch/replication/integ/rest/ClusterRerouteFollowerIT.kt index 189fa9fa3..4c93b6a71 100644 --- a/src/test/kotlin/org/opensearch/replication/integ/rest/ClusterRerouteFollowerIT.kt +++ b/src/test/kotlin/org/opensearch/replication/integ/rest/ClusterRerouteFollowerIT.kt @@ -1,16 +1,12 @@ package org.opensearch.replication.integ.rest -import org.opensearch.replication.MultiClusterRestTestCase -import org.opensearch.replication.MultiClusterAnnotations -import org.opensearch.replication.StartReplicationRequest -import org.opensearch.replication.startReplication -import org.opensearch.replication.stopReplication import org.assertj.core.api.Assertions import org.opensearch.client.RequestOptions import org.opensearch.client.indices.CreateIndexRequest import org.junit.Assert import org.junit.Assume import org.junit.Before +import org.opensearch.replication.* import java.util.concurrent.TimeUnit @@ -25,7 +21,7 @@ class ClusterRerouteFollowerIT : MultiClusterRestTestCase() { @Before fun beforeTest() { - Assume.assumeTrue(isMultiNodeClusterConfiguration(LEADER, FOLLOWER)) + Assume.assumeTrue(REROUTE_TESTS_NOT_ELIGIBLE_FOR_SINGLE_NODE_CLUSTER, isMultiNodeClusterConfiguration(LEADER, FOLLOWER)) } fun `test replication works after rerouting a shard from one node to another in follower cluster`() { diff --git a/src/test/kotlin/org/opensearch/replication/integ/rest/ClusterRerouteLeaderIT.kt b/src/test/kotlin/org/opensearch/replication/integ/rest/ClusterRerouteLeaderIT.kt index 03747f9a0..8d9341ae4 100644 --- a/src/test/kotlin/org/opensearch/replication/integ/rest/ClusterRerouteLeaderIT.kt +++ b/src/test/kotlin/org/opensearch/replication/integ/rest/ClusterRerouteLeaderIT.kt @@ -1,10 +1,5 @@ package org.opensearch.replication.integ.rest -import org.opensearch.replication.MultiClusterRestTestCase -import org.opensearch.replication.MultiClusterAnnotations -import org.opensearch.replication.StartReplicationRequest -import org.opensearch.replication.startReplication -import org.opensearch.replication.stopReplication import org.apache.hc.core5.http.ContentType import org.apache.hc.core5.http.io.entity.StringEntity import org.assertj.core.api.Assertions @@ -17,6 +12,7 @@ import org.junit.Assert import org.junit.Assume import org.junit.Before import org.junit.Ignore +import org.opensearch.replication.* import java.util.concurrent.TimeUnit @MultiClusterAnnotations.ClusterConfigurations( @@ -30,7 +26,7 @@ class ClusterRerouteLeaderIT : MultiClusterRestTestCase() { @Before fun beforeTest() { - Assume.assumeTrue(isMultiNodeClusterConfiguration(LEADER, FOLLOWER)) + Assume.assumeTrue(REROUTE_TESTS_NOT_ELIGIBLE_FOR_SINGLE_NODE_CLUSTER, isMultiNodeClusterConfiguration(LEADER, FOLLOWER),) } fun `test replication works after rerouting a shard from one node to another in leader cluster`() { diff --git a/src/test/kotlin/org/opensearch/replication/integ/rest/ResumeReplicationIT.kt b/src/test/kotlin/org/opensearch/replication/integ/rest/ResumeReplicationIT.kt index 4c060aac5..42ca3a8d9 100644 --- a/src/test/kotlin/org/opensearch/replication/integ/rest/ResumeReplicationIT.kt +++ b/src/test/kotlin/org/opensearch/replication/integ/rest/ResumeReplicationIT.kt @@ -11,20 +11,6 @@ package org.opensearch.replication.integ.rest -import org.opensearch.replication.MultiClusterAnnotations -import org.opensearch.replication.MultiClusterRestTestCase -import org.opensearch.replication.StartReplicationRequest -import org.opensearch.replication.`validate aggregated paused status response` -import org.opensearch.replication.`validate not paused status aggregated response` -import org.opensearch.replication.`validate not paused status response` -import org.opensearch.replication.`validate paused status response` -import org.opensearch.replication.`validate status syncing aggregated response` -import org.opensearch.replication.`validate status syncing response` -import org.opensearch.replication.pauseReplication -import org.opensearch.replication.replicationStatus -import org.opensearch.replication.resumeReplication -import org.opensearch.replication.startReplication -import org.opensearch.replication.stopReplication import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.assertThatThrownBy import org.opensearch.action.DocWriteResponse @@ -44,6 +30,7 @@ import org.junit.Assume import java.nio.file.Files import java.util.concurrent.TimeUnit import org.opensearch.bootstrap.BootstrapInfo +import org.opensearch.replication.* @MultiClusterAnnotations.ClusterConfigurations( MultiClusterAnnotations.ClusterConfiguration(clusterName = LEADER), @@ -166,7 +153,7 @@ class ResumeReplicationIT: MultiClusterRestTestCase() { fun `test that replication fails to resume when custom analyser is not present in follower`() { - Assume.assumeFalse(checkifIntegTestRemote()) + Assume.assumeFalse(ANALYZERS_NOT_ACCESSIBLE_FOR_REMOTE_DOMAINS, checkifIntegTestRemote()) val synonyms = javaClass.getResourceAsStream("/analyzers/synonyms.txt") val config = PathUtils.get(buildDir, leaderClusterPath, "config") @@ -201,7 +188,7 @@ class ResumeReplicationIT: MultiClusterRestTestCase() { fun `test that replication resumes when custom analyser is present in follower`() { - Assume.assumeFalse(checkifIntegTestRemote()) + Assume.assumeFalse(ANALYZERS_NOT_ACCESSIBLE_FOR_REMOTE_DOMAINS, checkifIntegTestRemote()) val synonyms = javaClass.getResourceAsStream("/analyzers/synonyms.txt") val config = PathUtils.get(buildDir, leaderClusterPath, "config") @@ -243,7 +230,7 @@ class ResumeReplicationIT: MultiClusterRestTestCase() { fun `test that replication resumes when custom analyser is overridden and present in follower`() { - Assume.assumeFalse(checkifIntegTestRemote()) + Assume.assumeFalse(ANALYZERS_NOT_ACCESSIBLE_FOR_REMOTE_DOMAINS, checkifIntegTestRemote()) val synonyms = javaClass.getResourceAsStream("/analyzers/synonyms.txt") val config = PathUtils.get(buildDir, leaderClusterPath, "config") diff --git a/src/test/kotlin/org/opensearch/replication/integ/rest/StartReplicationIT.kt b/src/test/kotlin/org/opensearch/replication/integ/rest/StartReplicationIT.kt index 539eac0ff..67753bf4e 100644 --- a/src/test/kotlin/org/opensearch/replication/integ/rest/StartReplicationIT.kt +++ b/src/test/kotlin/org/opensearch/replication/integ/rest/StartReplicationIT.kt @@ -13,20 +13,6 @@ package org.opensearch.replication.integ.rest import kotlinx.coroutines.delay -import org.opensearch.replication.IndexUtil -import org.opensearch.replication.MultiClusterAnnotations -import org.opensearch.replication.MultiClusterRestTestCase -import org.opensearch.replication.StartReplicationRequest -import org.opensearch.replication.`validate not paused status response` -import org.opensearch.replication.`validate paused status on closed index` -import org.opensearch.replication.pauseReplication -import org.opensearch.replication.replicationStatus -import org.opensearch.replication.resumeReplication -import org.opensearch.replication.`validate paused status response due to leader index deleted` -import org.opensearch.replication.`validate status syncing response` -import org.opensearch.replication.startReplication -import org.opensearch.replication.stopReplication -import org.opensearch.replication.updateReplication import org.apache.hc.core5.http.HttpStatus import org.apache.hc.core5.http.ContentType import org.apache.hc.core5.http.io.entity.StringEntity @@ -71,14 +57,12 @@ import org.opensearch.cluster.metadata.AliasMetadata import org.opensearch.core.xcontent.DeprecationHandler import org.opensearch.core.xcontent.NamedXContentRegistry import org.opensearch.replication.ReplicationPlugin.Companion.REPLICATION_INDEX_TRANSLOG_PRUNING_ENABLED_SETTING -import org.opensearch.replication.followerStats -import org.opensearch.replication.leaderStats -import org.opensearch.replication.updateReplicationStartBlockSetting import java.nio.file.Files import java.util.* import java.util.concurrent.TimeUnit import org.opensearch.bootstrap.BootstrapInfo import org.opensearch.index.mapper.Mapping +import org.opensearch.replication.* @MultiClusterAnnotations.ClusterConfigurations( @@ -586,7 +570,7 @@ class StartReplicationIT: MultiClusterRestTestCase() { fun `test that replication fails to start when custom analyser is not present in follower`() { - Assume.assumeFalse(checkifIntegTestRemote()) + Assume.assumeFalse(ANALYZERS_NOT_ACCESSIBLE_FOR_REMOTE_DOMAINS, checkifIntegTestRemote()) val synonyms = javaClass.getResourceAsStream("/analyzers/synonyms.txt") val config = PathUtils.get(buildDir, leaderClusterPath, "config") @@ -619,7 +603,7 @@ class StartReplicationIT: MultiClusterRestTestCase() { fun `test that replication starts successfully when custom analyser is present in follower`() { - Assume.assumeFalse(checkifIntegTestRemote()) + Assume.assumeFalse(ANALYZERS_NOT_ACCESSIBLE_FOR_REMOTE_DOMAINS, checkifIntegTestRemote()) val synonyms = javaClass.getResourceAsStream("/analyzers/synonyms.txt") val leaderConfig = PathUtils.get(buildDir, leaderClusterPath, "config") @@ -659,7 +643,7 @@ class StartReplicationIT: MultiClusterRestTestCase() { fun `test that replication starts successfully when custom analyser is overridden and present in follower`() { - Assume.assumeFalse(checkifIntegTestRemote()) + Assume.assumeFalse(ANALYZERS_NOT_ACCESSIBLE_FOR_REMOTE_DOMAINS, checkifIntegTestRemote()) val synonyms = javaClass.getResourceAsStream("/analyzers/synonyms.txt") val leaderConfig = PathUtils.get(buildDir, leaderClusterPath, "config") @@ -796,7 +780,7 @@ class StartReplicationIT: MultiClusterRestTestCase() { fun `test that snapshot on leader does not affect replication during bootstrap`() { - Assume.assumeFalse(checkifIntegTestRemote()) + Assume.assumeFalse(SNAPSHOTS_NOT_ACCESSIBLE_FOR_REMOTE_DOMAINS,checkifIntegTestRemote()) val settings = Settings.builder() .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 20) @@ -1141,8 +1125,8 @@ class StartReplicationIT: MultiClusterRestTestCase() { fun `test that wait_for_active_shards setting is updated on follower through start replication api`() { - //Ignore this test if clusters dont have multiple nodes - Assume.assumeTrue(isMultiNodeClusterConfiguration(LEADER, FOLLOWER)) + Assume.assumeTrue("Ignore this test if clusters dont have multiple nodes as this test reles on wait_for_active_shards", + isMultiNodeClusterConfiguration(LEADER, FOLLOWER)) val followerClient = getClientForCluster(FOLLOWER) val leaderClient = getClientForCluster(LEADER) diff --git a/src/test/kotlin/org/opensearch/replication/integ/rest/StopReplicationIT.kt b/src/test/kotlin/org/opensearch/replication/integ/rest/StopReplicationIT.kt index 902050564..24ed5e6ab 100644 --- a/src/test/kotlin/org/opensearch/replication/integ/rest/StopReplicationIT.kt +++ b/src/test/kotlin/org/opensearch/replication/integ/rest/StopReplicationIT.kt @@ -11,15 +11,6 @@ package org.opensearch.replication.integ.rest -import org.opensearch.replication.IndexUtil -import org.opensearch.replication.MultiClusterAnnotations -import org.opensearch.replication.MultiClusterRestTestCase -import org.opensearch.replication.StartReplicationRequest -import org.opensearch.replication.startReplication -import org.opensearch.replication.stopReplication -import org.opensearch.replication.replicationStatus -import org.opensearch.replication.getShardReplicationTasks -import org.opensearch.replication.`validate status syncing response` import org.apache.hc.core5.http.io.entity.EntityUtils import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.assertThatThrownBy @@ -41,6 +32,7 @@ import org.opensearch.cluster.metadata.IndexMetadata import org.opensearch.common.settings.Settings import org.opensearch.common.unit.TimeValue import org.opensearch.index.mapper.MapperService +import org.opensearch.replication.* import java.util.Random import java.util.concurrent.TimeUnit @@ -244,7 +236,7 @@ class StopReplicationIT: MultiClusterRestTestCase() { fun `test stop replication with stale replication settings at leader cluster`() { - Assume.assumeFalse(checkifIntegTestRemote()) + Assume.assumeFalse(SNAPSHOTS_NOT_ACCESSIBLE_FOR_REMOTE_DOMAINS, checkifIntegTestRemote()) val followerClient = getClientForCluster(FOLLOWER) val leaderClient = getClientForCluster(LEADER)