diff --git a/src/main/kotlin/org/opensearch/replication/action/index/TransportReplicateIndexAction.kt b/src/main/kotlin/org/opensearch/replication/action/index/TransportReplicateIndexAction.kt index 3000cb9bf..563a99962 100644 --- a/src/main/kotlin/org/opensearch/replication/action/index/TransportReplicateIndexAction.kt +++ b/src/main/kotlin/org/opensearch/replication/action/index/TransportReplicateIndexAction.kt @@ -135,7 +135,7 @@ class TransportReplicateIndexAction @Inject constructor(transportService: Transp private suspend fun getLeaderIndexSettings(leaderAlias: String, leaderIndex: String): Settings { val remoteClient = client.getRemoteClusterClient(leaderAlias) - val getSettingsRequest = GetSettingsRequest().includeDefaults(false).indices(leaderIndex) + val getSettingsRequest = GetSettingsRequest().includeDefaults(true).indices(leaderIndex) val settingsResponse = remoteClient.suspending(remoteClient.admin().indices()::getSettings, injectSecurityContext = true)(getSettingsRequest) return settingsResponse.indexToSettings.get(leaderIndex) ?: throw IndexNotFoundException("${leaderAlias}:${leaderIndex}") 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 18678016d..246641eb5 100644 --- a/src/test/kotlin/org/opensearch/replication/integ/rest/StartReplicationIT.kt +++ b/src/test/kotlin/org/opensearch/replication/integ/rest/StartReplicationIT.kt @@ -1181,11 +1181,12 @@ class StartReplicationIT: MultiClusterRestTestCase() { .put("index.data_path", "/random-path/invalid-setting") .build() - assertThatThrownBy { + try { followerClient.startReplication(StartReplicationRequest("source", leaderIndexName, followerIndexName, settings = settings)) - }.isInstanceOf(ResponseException::class.java).hasMessageContaining( - "Validation Failed: 1: custom path [/random-path/invalid-setting] is not a sub-path of path.shared_data" - ) + } catch (e: ResponseException) { + Assert.assertEquals(400, e.response.statusLine.statusCode) + Assert.assertTrue(e.message!!.contains("Validation Failed: 1: custom path [/random-path/invalid-setting] is not a sub-path of path.shared_data")) + } } fun `test that replication is not started when all primary shards are not in active state`() {