mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-01 00:19:11 +00:00
parent
9f6d6d540b
commit
4fa924494d
@ -101,6 +101,21 @@ public abstract class AbstractRandomizedTest extends RandomizedTest {
|
||||
*/
|
||||
public static final String TESTS_BACKWARDS_COMPATIBILITY_PATH = "tests.bwc.path";
|
||||
|
||||
/**
|
||||
* Annotation for REST tests
|
||||
*/
|
||||
@Inherited
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
@TestGroup(enabled = true, sysProperty = TESTS_REST)
|
||||
public @interface Rest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Property that allows to control whether the REST tests are run (default) or not
|
||||
*/
|
||||
public static final String TESTS_REST = "tests.rest";
|
||||
|
||||
/**
|
||||
* Annotation for integration tests
|
||||
*/
|
||||
|
@ -19,9 +19,12 @@
|
||||
|
||||
package org.elasticsearch.test.rest;
|
||||
|
||||
import com.carrotsearch.randomizedtesting.RandomizedTest;
|
||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||
import com.carrotsearch.randomizedtesting.annotations.TestGroup;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.lucene.util.AbstractRandomizedTest;
|
||||
import org.elasticsearch.Version;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
@ -54,13 +57,10 @@ import java.util.Set;
|
||||
//tests distribution disabled for now since it causes reporting problems,
|
||||
// due to the non unique suite name
|
||||
//@ReplicateOnEachVm
|
||||
@AbstractRandomizedTest.Rest
|
||||
@ClusterScope(randomDynamicTemplates = false)
|
||||
public class ElasticsearchRestTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
/**
|
||||
* Property that allows to control whether the REST tests need to be run (default) or not (false)
|
||||
*/
|
||||
public static final String REST_TESTS = "tests.rest";
|
||||
/**
|
||||
* Property that allows to control which REST tests get run. Supports comma separated list of tests
|
||||
* or directories that contain tests e.g. -Dtests.rest.suite=index,get,create/10_with_id
|
||||
@ -105,9 +105,19 @@ public class ElasticsearchRestTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
@ParametersFactory
|
||||
public static Iterable<Object[]> parameters() throws IOException, RestTestParseException {
|
||||
//skip REST tests if disabled through -Dtests.rest=false
|
||||
assumeTrue(systemPropertyAsBoolean(REST_TESTS, true));
|
||||
|
||||
TestGroup testGroup = Rest.class.getAnnotation(TestGroup.class);
|
||||
String sysProperty = TestGroup.Utilities.getSysProperty(Rest.class);
|
||||
boolean enabled;
|
||||
try {
|
||||
enabled = RandomizedTest.systemPropertyAsBoolean(sysProperty, testGroup.enabled());
|
||||
} catch (IllegalArgumentException e) {
|
||||
// Ignore malformed system property, disable the group if malformed though.
|
||||
enabled = false;
|
||||
}
|
||||
if (!enabled) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
//parse tests only if rest test group is enabled, otherwise rest tests might not even be available on file system
|
||||
List<RestTestCandidate> restTestCandidates = collectTestCandidates();
|
||||
List<Object[]> objects = Lists.newArrayList();
|
||||
for (RestTestCandidate restTestCandidate : restTestCandidates) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user