-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add base class for parameterizing the search based tests
Signed-off-by: Neetika Singhal <[email protected]>
- Loading branch information
1 parent
8afb22a
commit 110efe1
Showing
6 changed files
with
82 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 0 additions & 26 deletions
26
...internalClusterTest/java/org/opensearch/search/ConcurrentSegmentSearchCancellationIT.java
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
.../src/internalClusterTest/java/org/opensearch/search/ConcurrentSegmentSearchTimeoutIT.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
test/framework/src/main/java/org/opensearch/test/ConcurrentSearchIntegTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.test; | ||
|
||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; | ||
import org.junit.Before; | ||
import org.opensearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse; | ||
import org.opensearch.common.settings.FeatureFlagSettings; | ||
import org.opensearch.common.settings.Setting; | ||
import org.opensearch.common.settings.Settings; | ||
import org.opensearch.common.util.FeatureFlags; | ||
|
||
import java.util.Arrays; | ||
import java.util.Collection; | ||
|
||
import static org.opensearch.search.SearchService.CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING; | ||
|
||
public class ConcurrentSearchIntegTestCase extends OpenSearchIntegTestCase { | ||
|
||
protected final TestParameters testParameters; | ||
@ParametersFactory | ||
public static Collection<Object[]> parameters() { | ||
return Arrays.asList( | ||
new Object[] {new TestParameters(true)}, | ||
new Object[] {new TestParameters(false)} | ||
); | ||
} | ||
public ConcurrentSearchIntegTestCase(TestParameters testParameters) { | ||
this.testParameters = testParameters; | ||
} | ||
|
||
@Before | ||
void beforeTests() { | ||
ClusterUpdateSettingsResponse clusterUpdateSettingsResponse = client().admin() | ||
.cluster() | ||
.prepareUpdateSettings() | ||
.setPersistentSettings(Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), testParameters.isConcurrentSearchSettingVal())).get(); | ||
assertEquals(String.valueOf(testParameters.isConcurrentSearchSettingVal()), clusterUpdateSettingsResponse.getPersistentSettings().get(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey())); | ||
} | ||
|
||
// TODO: remove the function once the concurrent search experimental flag is removed | ||
@Override | ||
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.CONCURRENT_SEGMENT_SEARCH, true); | ||
return featureSettings.build(); | ||
} | ||
|
||
public static class TestParameters { | ||
private final boolean concurrentSearchSettingVal; | ||
|
||
public TestParameters(boolean concurrentSearchSettingVal) { | ||
this.concurrentSearchSettingVal = concurrentSearchSettingVal; | ||
} | ||
|
||
public boolean isConcurrentSearchSettingVal() { | ||
return concurrentSearchSettingVal; | ||
} | ||
} | ||
} |