|
66 | 66 | import org.opensearch.common.util.BigArrays;
|
67 | 67 | import org.opensearch.common.xcontent.NamedXContentRegistry;
|
68 | 68 | import org.opensearch.common.xcontent.XContentFactory;
|
| 69 | +import org.opensearch.env.Environment; |
69 | 70 | import org.opensearch.index.Index;
|
70 | 71 | import org.opensearch.index.IndexNotFoundException;
|
71 | 72 | import org.opensearch.index.IndexSettings;
|
@@ -963,6 +964,31 @@ null, Settings.EMPTY, IndexScopedSettings.DEFAULT_SCOPED_SETTINGS, randomShardLi
|
963 | 964 | + "and [index.translog.retention.size] are deprecated and effectively ignored. They will be removed in a future version.");
|
964 | 965 | }
|
965 | 966 |
|
| 967 | + public void testIndexLifecycleNameSetting() { |
| 968 | + // see: https://github.com/opensearch-project/OpenSearch/issues/1019 |
| 969 | + final Settings ilnSetting = Settings.builder().put("index.lifecycle.name", "dummy").build(); |
| 970 | + withTemporaryClusterService(((clusterService, threadPool) -> { |
| 971 | + MetadataCreateIndexService checkerService = new MetadataCreateIndexService( |
| 972 | + Settings.EMPTY, |
| 973 | + clusterService, |
| 974 | + null, |
| 975 | + null, |
| 976 | + null, |
| 977 | + createTestShardLimitService(randomIntBetween(1, 1000), clusterService), |
| 978 | + new Environment(Settings.builder().put("path.home", "dummy").build(), null), |
| 979 | + new IndexScopedSettings(ilnSetting, Collections.emptySet()), |
| 980 | + threadPool, |
| 981 | + null, |
| 982 | + new SystemIndices(Collections.emptyMap()), |
| 983 | + true |
| 984 | + ); |
| 985 | + |
| 986 | + final List<String> validationErrors = checkerService.getIndexSettingsValidationErrors(ilnSetting, true); |
| 987 | + assertThat(validationErrors.size(), is(1)); |
| 988 | + assertThat(validationErrors.get(0), is("expected [index.lifecycle.name] to be private but it was not")); |
| 989 | + })); |
| 990 | + } |
| 991 | + |
966 | 992 | private IndexTemplateMetadata addMatchingTemplate(Consumer<IndexTemplateMetadata.Builder> configurator) {
|
967 | 993 | IndexTemplateMetadata.Builder builder = templateMetadataBuilder("template1", "te*");
|
968 | 994 | configurator.accept(builder);
|
|
0 commit comments