From 4706fc1cea763f9059a442d54cdf4e4321c358b3 Mon Sep 17 00:00:00 2001 From: Harish Bhakuni Date: Sun, 20 Aug 2023 14:23:57 -0700 Subject: [PATCH] Address PR Changes Signed-off-by: Harish Bhakuni --- .../cluster/settings/ClusterSettingsIT.java | 26 ++----------------- .../opensearch/script/StoredScriptsIT.java | 24 ++--------------- .../opensearch/search/sort/FieldSortIT.java | 25 ++---------------- .../threadpool/SimpleThreadPoolIT.java | 26 +------------------ 4 files changed, 7 insertions(+), 94 deletions(-) diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/settings/ClusterSettingsIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/settings/ClusterSettingsIT.java index 16c2516294da1..541f1048bb246 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/settings/ClusterSettingsIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/settings/ClusterSettingsIT.java @@ -32,8 +32,6 @@ package org.opensearch.cluster.settings; -import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; - import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.opensearch.action.admin.cluster.settings.ClusterUpdateSettingsRequestBuilder; @@ -45,18 +43,15 @@ import org.opensearch.common.settings.Settings; import org.opensearch.common.settings.SettingsException; import org.opensearch.common.unit.TimeValue; -import org.opensearch.common.util.FeatureFlags; import org.opensearch.core.common.unit.ByteSizeUnit; import org.opensearch.indices.recovery.RecoverySettings; -import org.opensearch.test.ParameterizedOpenSearchIntegTestCase; +import org.opensearch.test.OpenSearchIntegTestCase; import org.junit.After; import java.util.Arrays; -import java.util.Collection; import static org.opensearch.cluster.routing.allocation.DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING; import static org.opensearch.cluster.routing.allocation.decider.ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_INITIAL_PRIMARIES_RECOVERIES_SETTING; -import static org.opensearch.search.SearchService.CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING; import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertAcked; import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertBlocked; import static org.hamcrest.Matchers.containsString; @@ -64,24 +59,7 @@ import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.nullValue; -public class ClusterSettingsIT extends ParameterizedOpenSearchIntegTestCase { - - public ClusterSettingsIT(Settings settings) { - super(settings); - } - - @ParametersFactory - public static Collection parameters() { - return Arrays.asList( - new Object[] { Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), false).build() }, - new Object[] { Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), true).build() } - ); - } - - @Override - protected Settings featureFlagSettings() { - return Settings.builder().put(super.featureFlagSettings()).put(FeatureFlags.CONCURRENT_SEGMENT_SEARCH, "true").build(); - } +public class ClusterSettingsIT extends OpenSearchIntegTestCase { @After public void cleanup() throws Exception { diff --git a/server/src/internalClusterTest/java/org/opensearch/script/StoredScriptsIT.java b/server/src/internalClusterTest/java/org/opensearch/script/StoredScriptsIT.java index 29f3343e309f1..71b48a8357e80 100644 --- a/server/src/internalClusterTest/java/org/opensearch/script/StoredScriptsIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/script/StoredScriptsIT.java @@ -31,14 +31,11 @@ package org.opensearch.script; -import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; - import org.opensearch.common.settings.Settings; -import org.opensearch.common.util.FeatureFlags; import org.opensearch.core.common.bytes.BytesArray; import org.opensearch.core.xcontent.MediaTypeRegistry; import org.opensearch.plugins.Plugin; -import org.opensearch.test.ParameterizedOpenSearchIntegTestCase; +import org.opensearch.test.OpenSearchIntegTestCase; import java.util.Arrays; import java.util.Collection; @@ -46,26 +43,9 @@ import java.util.Map; import java.util.function.Function; -import static org.opensearch.search.SearchService.CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING; import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertAcked; -public class StoredScriptsIT extends ParameterizedOpenSearchIntegTestCase { - public StoredScriptsIT(Settings settings) { - super(settings); - } - - @ParametersFactory - public static Collection parameters() { - return Arrays.asList( - new Object[] { Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), false).build() }, - new Object[] { Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), true).build() } - ); - } - - @Override - protected Settings featureFlagSettings() { - return Settings.builder().put(super.featureFlagSettings()).put(FeatureFlags.CONCURRENT_SEGMENT_SEARCH, "true").build(); - } +public class StoredScriptsIT extends OpenSearchIntegTestCase { private static final int SCRIPT_MAX_SIZE_IN_BYTES = 64; private static final String LANG = MockScriptEngine.NAME; diff --git a/server/src/internalClusterTest/java/org/opensearch/search/sort/FieldSortIT.java b/server/src/internalClusterTest/java/org/opensearch/search/sort/FieldSortIT.java index 10b0e60352dc5..6a68304fd72ae 100644 --- a/server/src/internalClusterTest/java/org/opensearch/search/sort/FieldSortIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/search/sort/FieldSortIT.java @@ -32,8 +32,6 @@ package org.opensearch.search.sort; -import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; - import org.apache.lucene.tests.util.TestUtil; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.UnicodeUtil; @@ -47,7 +45,6 @@ import org.opensearch.cluster.metadata.IndexMetadata; import org.opensearch.common.Numbers; import org.opensearch.common.settings.Settings; -import org.opensearch.common.util.FeatureFlags; import org.opensearch.common.xcontent.XContentFactory; import org.opensearch.core.rest.RestStatus; import org.opensearch.core.xcontent.MediaTypeRegistry; @@ -63,7 +60,7 @@ import org.opensearch.search.SearchHit; import org.opensearch.search.SearchHits; import org.opensearch.test.InternalSettingsPlugin; -import org.opensearch.test.ParameterizedOpenSearchIntegTestCase; +import org.opensearch.test.OpenSearchIntegTestCase; import org.hamcrest.Matchers; import java.io.IOException; @@ -89,7 +86,6 @@ import static org.opensearch.index.query.QueryBuilders.matchAllQuery; import static org.opensearch.index.query.functionscore.ScoreFunctionBuilders.fieldValueFactorFunction; import static org.opensearch.script.MockScriptPlugin.NAME; -import static org.opensearch.search.SearchService.CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING; import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertAcked; import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertFirstHit; import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertHitCount; @@ -109,24 +105,7 @@ import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.Matchers.oneOf; -public class FieldSortIT extends ParameterizedOpenSearchIntegTestCase { - public FieldSortIT(Settings settings) { - super(settings); - } - - @ParametersFactory - public static Collection parameters() { - return Arrays.asList( - new Object[] { Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), false).build() }, - new Object[] { Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), true).build() } - ); - } - - @Override - protected Settings featureFlagSettings() { - return Settings.builder().put(super.featureFlagSettings()).put(FeatureFlags.CONCURRENT_SEGMENT_SEARCH, "true").build(); - } - +public class FieldSortIT extends OpenSearchIntegTestCase { public static class CustomScriptPlugin extends MockScriptPlugin { @Override protected Map, Object>> pluginScripts() { diff --git a/server/src/internalClusterTest/java/org/opensearch/threadpool/SimpleThreadPoolIT.java b/server/src/internalClusterTest/java/org/opensearch/threadpool/SimpleThreadPoolIT.java index da31d5b127cb1..341725866b545 100644 --- a/server/src/internalClusterTest/java/org/opensearch/threadpool/SimpleThreadPoolIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/threadpool/SimpleThreadPoolIT.java @@ -32,50 +32,26 @@ package org.opensearch.threadpool; -import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; - import org.opensearch.action.index.IndexRequestBuilder; import org.opensearch.common.settings.Settings; -import org.opensearch.common.util.FeatureFlags; import org.opensearch.index.query.QueryBuilders; import org.opensearch.test.OpenSearchIntegTestCase; import org.opensearch.test.OpenSearchIntegTestCase.ClusterScope; import org.opensearch.test.OpenSearchIntegTestCase.Scope; -import org.opensearch.test.ParameterizedOpenSearchIntegTestCase; import org.opensearch.test.hamcrest.RegexMatcher; import java.lang.management.ManagementFactory; import java.lang.management.ThreadInfo; import java.lang.management.ThreadMXBean; -import java.util.Arrays; -import java.util.Collection; import java.util.HashSet; import java.util.Set; import java.util.regex.Pattern; import static org.opensearch.common.xcontent.XContentFactory.jsonBuilder; -import static org.opensearch.search.SearchService.CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING; import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertNoFailures; @ClusterScope(scope = Scope.TEST, numDataNodes = 0, numClientNodes = 0) -public class SimpleThreadPoolIT extends ParameterizedOpenSearchIntegTestCase { - public SimpleThreadPoolIT(Settings settings) { - super(settings); - } - - @ParametersFactory - public static Collection parameters() { - return Arrays.asList( - new Object[] { Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), false).build() }, - new Object[] { Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), true).build() } - ); - } - - @Override - protected Settings featureFlagSettings() { - return Settings.builder().put(super.featureFlagSettings()).put(FeatureFlags.CONCURRENT_SEGMENT_SEARCH, "true").build(); - } - +public class SimpleThreadPoolIT extends OpenSearchIntegTestCase { @Override protected Settings nodeSettings(int nodeOrdinal) { return Settings.builder().build();