Skip to content

Commit

Permalink
Added featureflag (#8988) (#9066)
Browse files Browse the repository at this point in the history
Added the featureFlagSettings method to OpenSearchSingleNodeTestCase

Signed-off-by: Stefano Maglione <[email protected]>
(cherry picked from commit d916f9c)

Co-authored-by: Stefano Maglione <[email protected]>
  • Loading branch information
reta and stefano-maglione authored Aug 2, 2023
1 parent a209c9b commit 335b977
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ protected void assertSnapshotOrGenericThread() {
}

@Override
protected Settings nodeSettings() {
return Settings.builder().put(super.nodeSettings()).put(FeatureFlags.REMOTE_STORE, "true").build();
protected Settings featureFlagSettings() {
return Settings.builder().put(super.featureFlagSettings()).put(FeatureFlags.REMOTE_STORE, "true").build();
}

public void testRetrieveSnapshots() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,14 @@ public void onQueryPhase(SearchContext context, long tookInNanos) {
}
}

@Override
protected Settings featureFlagSettings() {
return Settings.builder().put(super.featureFlagSettings()).put(FeatureFlags.CONCURRENT_SEGMENT_SEARCH, "true").build();
}

@Override
protected Settings nodeSettings() {
return Settings.builder().put("search.default_search_timeout", "5s").put(FeatureFlags.CONCURRENT_SEGMENT_SEARCH, true).build();
return Settings.builder().put("search.default_search_timeout", "5s").build();
}

public void testClearOnClose() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
import org.opensearch.cluster.metadata.Metadata;
import org.opensearch.cluster.routing.allocation.DiskThresholdSettings;
import org.opensearch.common.Priority;
import org.opensearch.common.settings.FeatureFlagSettings;
import org.opensearch.common.settings.Setting;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.unit.TimeValue;
import org.opensearch.common.util.BigArrays;
Expand Down Expand Up @@ -246,10 +248,9 @@ private Node newNode() {
.put(HierarchyCircuitBreakerService.USE_REAL_MEMORY_USAGE_SETTING.getKey(), false)
.putList(DISCOVERY_SEED_HOSTS_SETTING.getKey()) // empty list disables a port scan for other nodes
.putList(INITIAL_CLUSTER_MANAGER_NODES_SETTING.getKey(), nodeName)
.put(FeatureFlags.TELEMETRY_SETTING.getKey(), true)
.put(TelemetrySettings.TRACER_ENABLED_SETTING.getKey(), true);
// allow test cases to provide their own settings or override these
settingsBuilder.put(nodeSettings());
.put(TelemetrySettings.TRACER_ENABLED_SETTING.getKey(), true)
.put(nodeSettings()) // allow test cases to provide their own settings or override these
.put(featureFlagSettings());

if (Boolean.parseBoolean(settingsBuilder.get(FeatureFlags.CONCURRENT_SEGMENT_SEARCH))
&& (settingsBuilder.get(SearchBootstrapSettings.CONCURRENT_SEGMENT_SEARCH_TARGET_MAX_SLICE_COUNT_KEY) == null)) {
Expand Down Expand Up @@ -422,4 +423,19 @@ protected boolean forbidPrivateIndexSettings() {
return true;
}

/**
* Setting all feature flag settings at base IT, which can be overridden later by individual
* IT classes.
*
* @return Feature flag settings.
*/
protected Settings featureFlagSettings() {
Settings.Builder featureSettings = Settings.builder();
for (Setting builtInFlag : FeatureFlagSettings.BUILT_IN_FEATURE_FLAGS) {
featureSettings.put(builtInFlag.getKey(), builtInFlag.getDefaultRaw(Settings.EMPTY));
}
featureSettings.put(FeatureFlags.TELEMETRY_SETTING.getKey(), true);
return featureSettings.build();
}

}

0 comments on commit 335b977

Please sign in to comment.