[TEST] allow to fully disable REST tests included parsing via -Dtests.rest=false

We currently look for REST tests on file system although they are disabled. We should not do that and move the check earlier on. This way third parties using our test infra, which don't have REST tests on file system, can effectively disable the REST tests, otherwise they would get initialization error despite having disabled them.  The downside is that the number of tests visualized is going to be zero instead of the real number of parsed REST tests, but there is nothing we can do about this. Tests get ignored anyways.
This commit is contained in:
javanna 2014-09-18 17:04:48 +02:00 committed by Luca Cavanna
parent 66417a93a0
commit 508ff29e0d
1 changed files with 3 additions and 3 deletions

View File

@ -105,6 +105,9 @@ 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));
List<RestTestCandidate> restTestCandidates = collectTestCandidates();
List<Object[]> objects = Lists.newArrayList();
for (RestTestCandidate restTestCandidate : restTestCandidates) {
@ -160,9 +163,6 @@ public class ElasticsearchRestTests extends ElasticsearchIntegrationTest {
@BeforeClass
public static void initExecutionContext() throws IOException, RestException {
//skip REST tests if disabled through -Dtests.rest=false
assumeTrue(systemPropertyAsBoolean(REST_TESTS, true));
String[] specPaths = resolvePathsProperty(REST_TESTS_SPEC, DEFAULT_SPEC_PATH);
RestSpec restSpec = RestSpec.parseFrom(DEFAULT_SPEC_PATH, specPaths);
restTestExecutionContext = new RestTestExecutionContext(restSpec);