|
156 | 156 | import static org.opensearch.cluster.metadata.MetadataCreateIndexService.parseV1Mappings;
|
157 | 157 | import static org.opensearch.cluster.metadata.MetadataCreateIndexService.resolveAndValidateAliases;
|
158 | 158 | import static org.opensearch.cluster.routing.allocation.decider.ShardsLimitAllocationDecider.INDEX_TOTAL_PRIMARY_SHARDS_PER_NODE_SETTING;
|
| 159 | +import static org.opensearch.common.util.FeatureFlags.APPLICATION_BASED_CONFIGURATION_TEMPLATES; |
159 | 160 | import static org.opensearch.common.util.FeatureFlags.REMOTE_STORE_MIGRATION_EXPERIMENTAL;
|
160 | 161 | import static org.opensearch.index.IndexModule.INDEX_STORE_TYPE_SETTING;
|
161 | 162 | import static org.opensearch.index.IndexSettings.INDEX_MERGE_POLICY;
|
@@ -248,7 +249,7 @@ public void setupCreateIndexRequestAndAliasValidator() {
|
248 | 249 | public void tearDown() throws Exception {
|
249 | 250 | super.tearDown();
|
250 | 251 | // clear any FeatureFlags needed for individual tests
|
251 |
| - FeatureFlags.initializeFeatureFlags(Settings.EMPTY); |
| 252 | + FeatureFlags.TestUtils.reset(); |
252 | 253 | clusterSettings = null;
|
253 | 254 | }
|
254 | 255 |
|
@@ -1601,7 +1602,7 @@ public void testRemoteStoreOverrideTranslogRepoIndexSettings() {
|
1601 | 1602 | }
|
1602 | 1603 |
|
1603 | 1604 | public void testNewIndexIsRemoteStoreBackedForRemoteStoreDirectionAndMixedMode() {
|
1604 |
| - FeatureFlags.initializeFeatureFlags(Settings.builder().put(REMOTE_STORE_MIGRATION_EXPERIMENTAL, "true").build()); |
| 1605 | + FeatureFlags.TestUtils.set(REMOTE_STORE_MIGRATION_EXPERIMENTAL); |
1605 | 1606 |
|
1606 | 1607 | // non-remote cluster manager node
|
1607 | 1608 | DiscoveryNode nonRemoteClusterManagerNode = new DiscoveryNode(UUIDs.base64UUID(), buildNewFakeTransportAddress(), Version.CURRENT);
|
@@ -2314,7 +2315,7 @@ public void testIndexCreationWithIndexStoreTypeRemoteStoreThrowsException() {
|
2314 | 2315 |
|
2315 | 2316 | public void testCreateIndexWithContextDisabled() throws Exception {
|
2316 | 2317 | // Explicitly disable the FF
|
2317 |
| - FeatureFlags.initializeFeatureFlags(Settings.builder().put(FeatureFlags.APPLICATION_BASED_CONFIGURATION_TEMPLATES, false).build()); |
| 2318 | + FeatureFlags.TestUtils.set(APPLICATION_BASED_CONFIGURATION_TEMPLATES); |
2318 | 2319 | request = new CreateIndexClusterStateUpdateRequest("create index", "test", "test").context(new Context(randomAlphaOfLength(5)));
|
2319 | 2320 | withTemporaryClusterService((clusterService, threadPool) -> {
|
2320 | 2321 | MetadataCreateIndexService checkerService = new MetadataCreateIndexService(
|
@@ -2347,7 +2348,7 @@ public void testCreateIndexWithContextDisabled() throws Exception {
|
2347 | 2348 | }
|
2348 | 2349 |
|
2349 | 2350 | public void testCreateIndexWithContextAbsent() throws Exception {
|
2350 |
| - FeatureFlags.initializeFeatureFlags(Settings.builder().put(FeatureFlags.APPLICATION_BASED_CONFIGURATION_TEMPLATES, true).build()); |
| 2351 | + FeatureFlags.TestUtils.set(APPLICATION_BASED_CONFIGURATION_TEMPLATES); |
2351 | 2352 | request = new CreateIndexClusterStateUpdateRequest("create index", "test", "test").context(new Context(randomAlphaOfLength(5)));
|
2352 | 2353 | withTemporaryClusterService((clusterService, threadPool) -> {
|
2353 | 2354 | MetadataCreateIndexService checkerService = new MetadataCreateIndexService(
|
@@ -2380,7 +2381,7 @@ public void testCreateIndexWithContextAbsent() throws Exception {
|
2380 | 2381 | }
|
2381 | 2382 |
|
2382 | 2383 | public void testApplyContext() throws IOException {
|
2383 |
| - FeatureFlags.initializeFeatureFlags(Settings.builder().put(FeatureFlags.APPLICATION_BASED_CONFIGURATION_TEMPLATES, true).build()); |
| 2384 | + FeatureFlags.TestUtils.set(APPLICATION_BASED_CONFIGURATION_TEMPLATES); |
2384 | 2385 | request = new CreateIndexClusterStateUpdateRequest("create index", "test", "test").context(new Context(randomAlphaOfLength(5)));
|
2385 | 2386 |
|
2386 | 2387 | final Map<String, Object> mappings = new HashMap<>();
|
@@ -2477,7 +2478,7 @@ public void testApplyContext() throws IOException {
|
2477 | 2478 | }
|
2478 | 2479 |
|
2479 | 2480 | public void testApplyContextWithSettingsOverlap() throws IOException {
|
2480 |
| - FeatureFlags.initializeFeatureFlags(Settings.builder().put(FeatureFlags.APPLICATION_BASED_CONFIGURATION_TEMPLATES, true).build()); |
| 2481 | + FeatureFlags.TestUtils.set(APPLICATION_BASED_CONFIGURATION_TEMPLATES); |
2481 | 2482 | request = new CreateIndexClusterStateUpdateRequest("create index", "test", "test").context(new Context(randomAlphaOfLength(5)));
|
2482 | 2483 | Settings.Builder settingsBuilder = Settings.builder().put(INDEX_REFRESH_INTERVAL_SETTING.getKey(), "30s");
|
2483 | 2484 | String templateContent = "{\n"
|
|
0 commit comments