Skip to content

Commit

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

Signed-off-by: Stefano Maglione <[email protected]>
  • Loading branch information
stefano-maglione authored Aug 2, 2023
1 parent 9720528 commit d916f9c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,15 @@
* Tests for the {@link BlobStoreRepository} and its subclasses.
*/
public class BlobStoreRepositoryRemoteIndexTests extends BlobStoreRepositoryHelperTests {
@Override
protected Settings featureFlagSettings() {
return Settings.builder().put(super.featureFlagSettings()).put(FeatureFlags.REMOTE_STORE, "true").build();
}

@Override
protected Settings nodeSettings() {
return Settings.builder()
.put(super.nodeSettings())
.put(FeatureFlags.REMOTE_STORE, "true")
.put(CLUSTER_REPLICATION_TYPE_SETTING.getKey(), ReplicationType.SEGMENT)
.put(CLUSTER_REMOTE_STORE_ENABLED_SETTING.getKey(), true)
.put(CLUSTER_REMOTE_SEGMENT_STORE_REPOSITORY_SETTING.getKey(), "test-rs-repo")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,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 @@ -225,9 +225,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 @@ -248,6 +250,7 @@ private Node newNode() {
.put(FeatureFlags.TELEMETRY_SETTING.getKey(), true)
.put(TelemetrySettings.TRACER_ENABLED_SETTING.getKey(), true)
.put(nodeSettings()) // allow test cases to provide their own settings or override these
.put(featureFlagSettings())
.build();

Collection<Class<? extends Plugin>> plugins = getPlugins();
Expand Down Expand Up @@ -414,4 +417,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 d916f9c

Please sign in to comment.