Skip to content

Commit d2b4139

Browse files
author
AnnTian Shao
committed
fixes to tests
Signed-off-by: AnnTian Shao <anntians@amazon.com>
1 parent 49fc11a commit d2b4139

File tree

4 files changed

+4
-15
lines changed

4 files changed

+4
-15
lines changed

client/rest-high-level/src/test/java/org/opensearch/client/IndicesClientIT.java

-11
Original file line numberDiff line numberDiff line change
@@ -1468,17 +1468,6 @@ public void testIndexPutSettings() throws IOException {
14681468
)
14691469
);
14701470

1471-
UpdateSettingsRequest privateSettingRequest = new UpdateSettingsRequest(index);
1472-
privateSettingRequest.settings(Settings.builder().put(privateSettingKey, privateSettingValue).build());
1473-
exception = expectThrows(
1474-
OpenSearchException.class,
1475-
() -> execute(privateSettingRequest, highLevelClient().indices()::putSettings, highLevelClient().indices()::putSettingsAsync)
1476-
);
1477-
assertThat(
1478-
exception.getMessage(),
1479-
containsString("can not update private setting [index.creation_date]; this setting is managed by OpenSearch")
1480-
);
1481-
14821471
closeIndex(index);
14831472
exception = expectThrows(
14841473
OpenSearchException.class,

server/src/main/java/org/opensearch/cluster/metadata/IndexMetadata.java

-1
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,6 @@ public static APIBlock readFrom(StreamInput input) throws IOException {
581581
-1,
582582
-1,
583583
Property.IndexScope,
584-
Property.NodeScope,
585584
Property.PrivateIndex,
586585
Property.UnmodifiableOnRestore
587586
);

server/src/main/java/org/opensearch/common/settings/IndexScopedSettings.java

-3
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,6 @@ protected void validateSettingKey(Setting setting) {
313313
@Override
314314
public boolean isPrivateSetting(String key) {
315315
switch (key) {
316-
case IndexMetadata.SETTING_CREATION_DATE:
317-
case IndexMetadata.SETTING_INDEX_UUID:
318-
case IndexMetadata.SETTING_HISTORY_UUID:
319316
case IndexMetadata.SETTING_VERSION_UPGRADED:
320317
case IndexMetadata.SETTING_INDEX_PROVIDED_NAME:
321318
case MergePolicyProvider.INDEX_MERGE_ENABLED:

server/src/test/java/org/opensearch/index/IndexSettingsTests.java

+4
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,10 @@ public void testTranslogGenerationSizeThreshold() {
607607
assertEquals(actual, settings.getGenerationThresholdSize());
608608
}
609609

610+
/**
611+
* Test private setting validation for private settings defined in isPrivateSetting()
612+
* https://github.com/opensearch-project/OpenSearch/blob/main/server/src/main/java/org/opensearch/common/settings/IndexScopedSettings.java
613+
*/
610614
public void testPrivateSettingsValidation() {
611615
final Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_UPGRADED, Version.V_EMPTY).build();
612616
final IndexScopedSettings indexScopedSettings = new IndexScopedSettings(settings, IndexScopedSettings.BUILT_IN_INDEX_SETTINGS);

0 commit comments

Comments
 (0)