forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
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 (opensearch-…
…project#9083) Signed-off-by: Neetika Singhal <[email protected]>
- Loading branch information
1 parent
4114009
commit 0a7eade
Showing
6 changed files
with
93 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
47 changes: 47 additions & 0 deletions
47
test/framework/src/main/java/org/opensearch/test/ParameterizedOpenSearchIntegTestCase.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,47 @@ | ||
/* | ||
* 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 org.junit.After; | ||
import org.junit.Before; | ||
import org.opensearch.common.settings.Settings; | ||
import org.opensearch.common.settings.SettingsModule; | ||
|
||
/** | ||
* Base class for running the tests with parameterization of the dynamic settings | ||
* For any class that wants to use parameterization, use @ParametersFactory to generate | ||
* different params only for dynamic settings. Refer SearchCancellationIT for an example. | ||
* Note: this doesn't work for the parameterization of feature flag/static settings. | ||
*/ | ||
public abstract class ParameterizedOpenSearchIntegTestCase extends OpenSearchIntegTestCase { | ||
|
||
private final Settings dynamicSettings; | ||
|
||
public ParameterizedOpenSearchIntegTestCase(Settings dynamicSettings) { | ||
this.dynamicSettings = dynamicSettings; | ||
} | ||
|
||
@Before | ||
public void beforeTests() { | ||
SettingsModule settingsModule = new SettingsModule(dynamicSettings); | ||
for (String key : dynamicSettings.keySet()) { | ||
assertTrue( | ||
settingsModule.getClusterSettings().isDynamicSetting(key) || settingsModule.getIndexScopedSettings().isDynamicSetting(key) | ||
); | ||
} | ||
client().admin().cluster().prepareUpdateSettings().setPersistentSettings(dynamicSettings).get(); | ||
} | ||
|
||
@After | ||
public void afterTests() { | ||
final Settings.Builder settingsToUnset = Settings.builder(); | ||
dynamicSettings.keySet().forEach(settingsToUnset::putNull); | ||
client().admin().cluster().prepareUpdateSettings().setPersistentSettings(settingsToUnset).get(); | ||
} | ||
} |