Skip to content

Commit 6fb72bf

Browse files
committed
Retrieving default settings and validating status code in IT
1 parent 85212b4 commit 6fb72bf

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/main/kotlin/org/opensearch/replication/action/index/TransportReplicateIndexAction.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ class TransportReplicateIndexAction @Inject constructor(transportService: Transp
135135

136136
private suspend fun getLeaderIndexSettings(leaderAlias: String, leaderIndex: String): Settings {
137137
val remoteClient = client.getRemoteClusterClient(leaderAlias)
138-
val getSettingsRequest = GetSettingsRequest().includeDefaults(false).indices(leaderIndex)
138+
val getSettingsRequest = GetSettingsRequest().includeDefaults(true).indices(leaderIndex)
139139
val settingsResponse = remoteClient.suspending(remoteClient.admin().indices()::getSettings,
140140
injectSecurityContext = true)(getSettingsRequest)
141141
return settingsResponse.indexToSettings.get(leaderIndex) ?: throw IndexNotFoundException("${leaderAlias}:${leaderIndex}")

src/test/kotlin/org/opensearch/replication/integ/rest/StartReplicationIT.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,11 +1181,12 @@ class StartReplicationIT: MultiClusterRestTestCase() {
11811181
.put("index.data_path", "/random-path/invalid-setting")
11821182
.build()
11831183

1184-
assertThatThrownBy {
1184+
try {
11851185
followerClient.startReplication(StartReplicationRequest("source", leaderIndexName, followerIndexName, settings = settings))
1186-
}.isInstanceOf(ResponseException::class.java).hasMessageContaining(
1187-
"Validation Failed: 1: custom path [/random-path/invalid-setting] is not a sub-path of path.shared_data"
1188-
)
1186+
} catch (e: ResponseException) {
1187+
Assert.assertEquals(400, e.response.statusLine.statusCode)
1188+
Assert.assertTrue(e.message!!.contains("Validation Failed: 1: custom path [/random-path/invalid-setting] is not a sub-path of path.shared_data"))
1189+
}
11891190
}
11901191

11911192
fun `test that replication is not started when all primary shards are not in active state`() {

0 commit comments

Comments
 (0)