Skip to content

Commit 0358d99

Browse files
author
Harish Bhakuni
committed
Parameterize ITs to run with concurrent search enabled
Signed-off-by: Harish Bhakuni <hbhakuni@amazon.com>
1 parent bc40428 commit 0358d99

21 files changed

+492
-37
lines changed

server/src/internalClusterTest/java/org/opensearch/cluster/settings/ClusterSettingsIT.java

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232

3333
package org.opensearch.cluster.settings;
3434

35+
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
36+
3537
import org.apache.logging.log4j.Level;
3638
import org.apache.logging.log4j.LogManager;
3739
import org.opensearch.action.admin.cluster.settings.ClusterUpdateSettingsRequestBuilder;
@@ -43,23 +45,43 @@
4345
import org.opensearch.common.settings.Settings;
4446
import org.opensearch.common.settings.SettingsException;
4547
import org.opensearch.common.unit.TimeValue;
48+
import org.opensearch.common.util.FeatureFlags;
4649
import org.opensearch.core.common.unit.ByteSizeUnit;
4750
import org.opensearch.indices.recovery.RecoverySettings;
48-
import org.opensearch.test.OpenSearchIntegTestCase;
51+
import org.opensearch.test.ParameterizedOpenSearchIntegTestCase;
4952
import org.junit.After;
5053

5154
import java.util.Arrays;
55+
import java.util.Collection;
5256

5357
import static org.opensearch.cluster.routing.allocation.DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING;
5458
import static org.opensearch.cluster.routing.allocation.decider.ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_INITIAL_PRIMARIES_RECOVERIES_SETTING;
59+
import static org.opensearch.search.SearchService.CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING;
5560
import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertAcked;
5661
import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertBlocked;
5762
import static org.hamcrest.Matchers.containsString;
5863
import static org.hamcrest.Matchers.equalTo;
5964
import static org.hamcrest.Matchers.notNullValue;
6065
import static org.hamcrest.Matchers.nullValue;
6166

62-
public class ClusterSettingsIT extends OpenSearchIntegTestCase {
67+
public class ClusterSettingsIT extends ParameterizedOpenSearchIntegTestCase {
68+
69+
public ClusterSettingsIT(Settings settings) {
70+
super(settings);
71+
}
72+
73+
@ParametersFactory
74+
public static Collection<Object[]> parameters() {
75+
return Arrays.asList(
76+
new Object[] { Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), false).build() },
77+
new Object[] { Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), true).build() }
78+
);
79+
}
80+
81+
@Override
82+
protected Settings featureFlagSettings() {
83+
return Settings.builder().put(super.featureFlagSettings()).put(FeatureFlags.CONCURRENT_SEGMENT_SEARCH, "true").build();
84+
}
6385

6486
@After
6587
public void cleanup() throws Exception {

server/src/internalClusterTest/java/org/opensearch/indices/IndicesRequestCacheIT.java

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232

3333
package org.opensearch.indices;
3434

35+
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
36+
3537
import org.opensearch.action.admin.indices.alias.Alias;
3638
import org.opensearch.action.admin.indices.forcemerge.ForceMergeResponse;
3739
import org.opensearch.action.search.SearchResponse;
@@ -40,22 +42,25 @@
4042
import org.opensearch.cluster.metadata.IndexMetadata;
4143
import org.opensearch.common.settings.Settings;
4244
import org.opensearch.common.time.DateFormatter;
45+
import org.opensearch.common.util.FeatureFlags;
4346
import org.opensearch.index.cache.request.RequestCacheStats;
4447
import org.opensearch.index.query.QueryBuilders;
4548
import org.opensearch.search.aggregations.bucket.global.GlobalAggregationBuilder;
4649
import org.opensearch.search.aggregations.bucket.histogram.DateHistogramInterval;
4750
import org.opensearch.search.aggregations.bucket.histogram.Histogram;
4851
import org.opensearch.search.aggregations.bucket.histogram.Histogram.Bucket;
49-
import org.opensearch.test.OpenSearchIntegTestCase;
52+
import org.opensearch.test.ParameterizedOpenSearchIntegTestCase;
5053
import org.opensearch.test.hamcrest.OpenSearchAssertions;
5154

5255
import java.time.ZoneId;
5356
import java.time.ZoneOffset;
5457
import java.time.ZonedDateTime;
5558
import java.time.format.DateTimeFormatter;
5659
import java.util.Arrays;
60+
import java.util.Collection;
5761
import java.util.List;
5862

63+
import static org.opensearch.search.SearchService.CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING;
5964
import static org.opensearch.search.aggregations.AggregationBuilders.dateHistogram;
6065
import static org.opensearch.search.aggregations.AggregationBuilders.dateRange;
6166
import static org.opensearch.search.aggregations.AggregationBuilders.filter;
@@ -64,7 +69,23 @@
6469
import static org.hamcrest.Matchers.equalTo;
6570
import static org.hamcrest.Matchers.greaterThan;
6671

67-
public class IndicesRequestCacheIT extends OpenSearchIntegTestCase {
72+
public class IndicesRequestCacheIT extends ParameterizedOpenSearchIntegTestCase {
73+
public IndicesRequestCacheIT(Settings settings) {
74+
super(settings);
75+
}
76+
77+
@ParametersFactory
78+
public static Collection<Object[]> parameters() {
79+
return Arrays.asList(
80+
new Object[] { Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), false).build() },
81+
new Object[] { Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), true).build() }
82+
);
83+
}
84+
85+
@Override
86+
protected Settings featureFlagSettings() {
87+
return Settings.builder().put(super.featureFlagSettings()).put(FeatureFlags.CONCURRENT_SEGMENT_SEARCH, "true").build();
88+
}
6889

6990
// One of the primary purposes of the query cache is to cache aggs results
7091
public void testCacheAggs() throws Exception {

server/src/internalClusterTest/java/org/opensearch/indices/stats/IndexStatsIT.java

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232

3333
package org.opensearch.indices.stats;
3434

35+
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
36+
3537
import org.apache.lucene.tests.util.LuceneTestCase.SuppressCodecs;
3638
import org.opensearch.action.DocWriteResponse;
3739
import org.opensearch.action.admin.cluster.node.stats.NodesStatsResponse;
@@ -55,6 +57,7 @@
5557
import org.opensearch.common.io.stream.BytesStreamOutput;
5658
import org.opensearch.common.settings.Settings;
5759
import org.opensearch.common.unit.TimeValue;
60+
import org.opensearch.common.util.FeatureFlags;
5861
import org.opensearch.core.action.support.DefaultShardOperationFailedException;
5962
import org.opensearch.core.common.bytes.BytesReference;
6063
import org.opensearch.core.common.io.stream.StreamOutput;
@@ -80,9 +83,9 @@
8083
import org.opensearch.plugins.Plugin;
8184
import org.opensearch.search.sort.SortOrder;
8285
import org.opensearch.test.InternalSettingsPlugin;
83-
import org.opensearch.test.OpenSearchIntegTestCase;
8486
import org.opensearch.test.OpenSearchIntegTestCase.ClusterScope;
8587
import org.opensearch.test.OpenSearchIntegTestCase.Scope;
88+
import org.opensearch.test.ParameterizedOpenSearchIntegTestCase;
8689

8790
import java.io.IOException;
8891
import java.util.ArrayList;
@@ -105,6 +108,7 @@
105108

106109
import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS;
107110
import static org.opensearch.common.xcontent.XContentFactory.jsonBuilder;
111+
import static org.opensearch.search.SearchService.CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING;
108112
import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertAcked;
109113
import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertAllSuccessful;
110114
import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertSearchResponse;
@@ -118,7 +122,23 @@
118122

119123
@ClusterScope(scope = Scope.SUITE, numDataNodes = 2, numClientNodes = 0)
120124
@SuppressCodecs("*") // requires custom completion format
121-
public class IndexStatsIT extends OpenSearchIntegTestCase {
125+
public class IndexStatsIT extends ParameterizedOpenSearchIntegTestCase {
126+
public IndexStatsIT(Settings settings) {
127+
super(settings);
128+
}
129+
130+
@ParametersFactory
131+
public static Collection<Object[]> parameters() {
132+
return Arrays.asList(
133+
new Object[] { Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), false).build() },
134+
new Object[] { Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), true).build() }
135+
);
136+
}
137+
138+
@Override
139+
protected Settings featureFlagSettings() {
140+
return Settings.builder().put(super.featureFlagSettings()).put(FeatureFlags.CONCURRENT_SEGMENT_SEARCH, "true").build();
141+
}
122142

123143
@Override
124144
protected Collection<Class<? extends Plugin>> nodePlugins() {

server/src/internalClusterTest/java/org/opensearch/script/ScriptCacheIT.java

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@
88

99
package org.opensearch.script;
1010

11+
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
12+
1113
import org.opensearch.OpenSearchException;
1214
import org.opensearch.common.settings.Settings;
15+
import org.opensearch.common.util.FeatureFlags;
1316
import org.opensearch.common.xcontent.XContentFactory;
1417
import org.opensearch.core.rest.RestStatus;
1518
import org.opensearch.index.MockEngineFactoryPlugin;
@@ -18,22 +21,40 @@
1821
import org.opensearch.plugins.Plugin;
1922
import org.opensearch.search.MockSearchService;
2023
import org.opensearch.test.MockHttpTransport;
21-
import org.opensearch.test.OpenSearchIntegTestCase;
24+
import org.opensearch.test.ParameterizedOpenSearchIntegTestCase;
2225
import org.opensearch.test.TestGeoShapeFieldMapperPlugin;
2326
import org.opensearch.test.store.MockFSIndexStore;
2427
import org.opensearch.test.transport.MockTransportService;
2528

2629
import java.util.ArrayList;
30+
import java.util.Arrays;
2731
import java.util.Collection;
2832
import java.util.Collections;
2933
import java.util.HashMap;
3034
import java.util.Map;
3135
import java.util.concurrent.ExecutionException;
3236
import java.util.function.Function;
3337

38+
import static org.opensearch.search.SearchService.CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING;
3439
import static org.apache.logging.log4j.core.util.Throwables.getRootCause;
3540

36-
public class ScriptCacheIT extends OpenSearchIntegTestCase {
41+
public class ScriptCacheIT extends ParameterizedOpenSearchIntegTestCase {
42+
public ScriptCacheIT(Settings settings) {
43+
super(settings);
44+
}
45+
46+
@ParametersFactory
47+
public static Collection<Object[]> parameters() {
48+
return Arrays.asList(
49+
new Object[] { Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), false).build() },
50+
new Object[] { Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), true).build() }
51+
);
52+
}
53+
54+
@Override
55+
protected Settings featureFlagSettings() {
56+
return Settings.builder().put(super.featureFlagSettings()).put(FeatureFlags.CONCURRENT_SEGMENT_SEARCH, "true").build();
57+
}
3758

3859
protected Settings nodeSettings(int nodeOrdinal) {
3960
Settings.Builder builder = Settings.builder()

server/src/internalClusterTest/java/org/opensearch/script/StoredScriptsIT.java

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,41 @@
3131

3232
package org.opensearch.script;
3333

34+
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
35+
3436
import org.opensearch.common.settings.Settings;
37+
import org.opensearch.common.util.FeatureFlags;
3538
import org.opensearch.core.common.bytes.BytesArray;
3639
import org.opensearch.core.xcontent.MediaTypeRegistry;
3740
import org.opensearch.plugins.Plugin;
38-
import org.opensearch.test.OpenSearchIntegTestCase;
41+
import org.opensearch.test.ParameterizedOpenSearchIntegTestCase;
3942

4043
import java.util.Arrays;
4144
import java.util.Collection;
4245
import java.util.Collections;
4346
import java.util.Map;
4447
import java.util.function.Function;
4548

49+
import static org.opensearch.search.SearchService.CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING;
4650
import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertAcked;
4751

48-
public class StoredScriptsIT extends OpenSearchIntegTestCase {
52+
public class StoredScriptsIT extends ParameterizedOpenSearchIntegTestCase {
53+
public StoredScriptsIT(Settings settings) {
54+
super(settings);
55+
}
56+
57+
@ParametersFactory
58+
public static Collection<Object[]> parameters() {
59+
return Arrays.asList(
60+
new Object[] { Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), false).build() },
61+
new Object[] { Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), true).build() }
62+
);
63+
}
64+
65+
@Override
66+
protected Settings featureFlagSettings() {
67+
return Settings.builder().put(super.featureFlagSettings()).put(FeatureFlags.CONCURRENT_SEGMENT_SEARCH, "true").build();
68+
}
4969

5070
private static final int SCRIPT_MAX_SIZE_IN_BYTES = 64;
5171
private static final String LANG = MockScriptEngine.NAME;

server/src/internalClusterTest/java/org/opensearch/search/StressSearchServiceReaperIT.java

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,45 @@
3131

3232
package org.opensearch.search;
3333

34+
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
35+
3436
import org.apache.lucene.tests.util.English;
3537
import org.opensearch.action.index.IndexRequestBuilder;
3638
import org.opensearch.action.search.SearchResponse;
3739
import org.opensearch.common.settings.Settings;
3840
import org.opensearch.common.unit.TimeValue;
39-
import org.opensearch.test.OpenSearchIntegTestCase;
41+
import org.opensearch.common.util.FeatureFlags;
4042
import org.opensearch.test.OpenSearchIntegTestCase.ClusterScope;
43+
import org.opensearch.test.ParameterizedOpenSearchIntegTestCase;
4144

45+
import java.util.Arrays;
46+
import java.util.Collection;
4247
import java.util.concurrent.ExecutionException;
4348

4449
import static org.opensearch.index.query.QueryBuilders.matchAllQuery;
50+
import static org.opensearch.search.SearchService.CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING;
4551
import static org.opensearch.test.OpenSearchIntegTestCase.Scope.SUITE;
4652
import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertHitCount;
4753
import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertNoFailures;
4854

4955
@ClusterScope(scope = SUITE)
50-
public class StressSearchServiceReaperIT extends OpenSearchIntegTestCase {
56+
public class StressSearchServiceReaperIT extends ParameterizedOpenSearchIntegTestCase {
57+
public StressSearchServiceReaperIT(Settings settings) {
58+
super(settings);
59+
}
60+
61+
@ParametersFactory
62+
public static Collection<Object[]> parameters() {
63+
return Arrays.asList(
64+
new Object[] { Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), false).build() },
65+
new Object[] { Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), true).build() }
66+
);
67+
}
68+
69+
@Override
70+
protected Settings featureFlagSettings() {
71+
return Settings.builder().put(super.featureFlagSettings()).put(FeatureFlags.CONCURRENT_SEGMENT_SEARCH, "true").build();
72+
}
5173

5274
@Override
5375
protected Settings nodeSettings(int nodeOrdinal) {

server/src/internalClusterTest/java/org/opensearch/search/pit/DeletePitMultiNodeIT.java

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
package org.opensearch.search.pit;
1010

1111
import org.opensearch.ExceptionsHelper;
12+
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
1213
import org.opensearch.action.LatchedActionListener;
1314
import org.opensearch.action.admin.indices.stats.IndicesStatsRequest;
1415
import org.opensearch.action.admin.indices.stats.IndicesStatsResponse;
@@ -25,17 +26,21 @@
2526
import org.opensearch.common.action.ActionFuture;
2627
import org.opensearch.common.settings.Settings;
2728
import org.opensearch.common.unit.TimeValue;
29+
import org.opensearch.common.util.FeatureFlags;
2830
import org.opensearch.core.action.ActionListener;
2931
import org.opensearch.search.SearchContextMissingException;
3032
import org.opensearch.search.builder.PointInTimeBuilder;
3133
import org.opensearch.test.InternalTestCluster;
3234
import org.opensearch.test.OpenSearchIntegTestCase;
35+
import org.opensearch.test.ParameterizedOpenSearchIntegTestCase;
3336
import org.opensearch.threadpool.TestThreadPool;
3437
import org.opensearch.threadpool.ThreadPool;
3538
import org.junit.After;
3639
import org.junit.Before;
3740

3841
import java.util.ArrayList;
42+
import java.util.Arrays;
43+
import java.util.Collection;
3944
import java.util.List;
4045
import java.util.concurrent.CountDownLatch;
4146
import java.util.concurrent.ExecutionException;
@@ -44,6 +49,7 @@
4449
import java.util.concurrent.atomic.AtomicInteger;
4550

4651
import static org.opensearch.action.support.WriteRequest.RefreshPolicy.IMMEDIATE;
52+
import static org.opensearch.search.SearchService.CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING;
4753
import static org.hamcrest.Matchers.blankOrNullString;
4854
import static org.hamcrest.Matchers.containsString;
4955
import static org.hamcrest.Matchers.not;
@@ -52,7 +58,23 @@
5258
* Multi node integration tests for delete PIT use cases
5359
*/
5460
@OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.SUITE, numDataNodes = 2)
55-
public class DeletePitMultiNodeIT extends OpenSearchIntegTestCase {
61+
public class DeletePitMultiNodeIT extends ParameterizedOpenSearchIntegTestCase {
62+
public DeletePitMultiNodeIT(Settings settings) {
63+
super(settings);
64+
}
65+
66+
@ParametersFactory
67+
public static Collection<Object[]> parameters() {
68+
return Arrays.asList(
69+
new Object[] { Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), false).build() },
70+
new Object[] { Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), true).build() }
71+
);
72+
}
73+
74+
@Override
75+
protected Settings featureFlagSettings() {
76+
return Settings.builder().put(super.featureFlagSettings()).put(FeatureFlags.CONCURRENT_SEGMENT_SEARCH, "true").build();
77+
}
5678

5779
@Before
5880
public void setupIndex() throws ExecutionException, InterruptedException {

0 commit comments

Comments
 (0)