Skip to content

Commit

Permalink
Added comments for skipped tests
Browse files Browse the repository at this point in the history
Signed-off-by: monusingh-1 <[email protected]>
  • Loading branch information
monusingh-1 committed Aug 17, 2023
1 parent b56c286 commit 1fc05e3
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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


Expand All @@ -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`() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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(
Expand All @@ -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`() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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),
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 1fc05e3

Please sign in to comment.