removed rest-spec submodule and prepared project for same files added directly to the codebase (no submodule) within rest-api-spec

(temporarily disabled FileUtilsTests & REST tests as there's temporarily no rest-spec dir)

Relates to #4540 #4376
This commit is contained in:
Luca Cavanna 2013-12-27 20:36:12 +01:00
parent 51bec4ec6c
commit 63cbc84393
8 changed files with 24 additions and 76 deletions

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "rest-spec"]
path = rest-spec
url = https://github.com/elasticsearch/elasticsearch-rest-api-spec.git

View File

@ -167,12 +167,8 @@ The available integration tests make use of the java API to communicate with
the elasticsearch nodes, using the internal binary transport (port 9300 by
default).
The REST layer is tested through specific tests that are shared between all
the elasticsearch official clients and can be found on the
https://github.com/elasticsearch/elasticsearch-rest-api-spec[elasticsearch-rest-api-spec project].
They consist of
https://github.com/elasticsearch/elasticsearch-rest-api-spec/tree/master/test[YAML files]
that describe the operations to be executed and the obtained results that
need to be tested.
the elasticsearch official clients and consist of YAML files that describe the
operations to be executed and the obtained results that need to be tested.
The REST tests are run automatically when executing the maven test command. To run only the
REST tests use the following command:
@ -182,17 +178,7 @@ mvn test -Dtests.class=org.elasticsearch.test.rest.ElasticsearchRestTests
---------------------------------------------------------------------------
`ElasticsearchRestTests` is the executable test class that runs all the
yaml suites available through a git submodule within the `rest-spec` folder.
The submodule gets automatically initialized through maven right before
running tests (generate-test-resources phase).
The REST tests cannot be run without the files pulled from the submodule,
thus if the `rest-spec` folder is empty on your working copy, it means
that it needs to be initialized with the following command:
------------------------------
git submodule update --init
------------------------------
yaml suites available within the `rest-spec` folder.
The following are the options supported by the REST tests runner:

41
pom.xml
View File

@ -35,8 +35,6 @@
<tests.shuffle>true</tests.shuffle>
<tests.output>onerror</tests.output>
<tests.client.ratio></tests.client.ratio>
<rest.pull.skip>false</rest.pull.skip>
<rest.init.skip>false</rest.init.skip>
<es.logger.level>INFO</es.logger.level>
</properties>
@ -322,8 +320,8 @@
</includes>
</testResource>
<testResource>
<directory>${basedir}/rest-spec</directory>
<targetPath>rest-spec</targetPath>
<directory>${basedir}/rest-api-spec</directory>
<targetPath>rest-api-spec</targetPath>
<includes>
<include>api/*.json</include>
<include>test/**/*.yaml</include>
@ -1029,41 +1027,6 @@
</arguments>
</configuration>
</execution>
<execution>
<id>Init Rest Spec</id>
<phase>generate-test-resources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<skip>${rest.init.skip}</skip>
<executable>git</executable>
<arguments>
<argument>submodule</argument>
<argument>update</argument>
<argument>--init</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>Pull Rest Spec</id>
<phase>generate-test-resources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<skip>${rest.pull.skip}</skip>
<executable>git</executable>
<arguments>
<argument>submodule</argument>
<argument>foreach</argument>
<argument>git</argument>
<argument>pull</argument>
<argument>origin</argument>
<argument>master</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>

@ -1 +0,0 @@
Subproject commit b3ab72486fae1b5c5a5397356a3e113bf72eb6d5

View File

@ -19,7 +19,7 @@
package org.elasticsearch.test.rest;
import org.elasticsearch.test.rest.junit.RestTestSuiteRunner;
import org.junit.runner.RunWith;
import org.junit.Ignore;
import static org.apache.lucene.util.LuceneTestCase.Slow;
@ -30,7 +30,8 @@ import static org.apache.lucene.util.LuceneTestCase.Slow;
* @see RestTestSuiteRunner for extensive documentation and all the supported options
*/
@Slow
@RunWith(RestTestSuiteRunner.class)
//@RunWith(RestTestSuiteRunner.class)
@Ignore
public class ElasticsearchRestTests {

View File

@ -69,10 +69,10 @@ import static org.junit.Assert.assertThat;
* Supports the following options provided as system properties:
* - tests.rest[true|false|host:port]: determines whether the REST tests need to be run and if so
* whether to rely on an external cluster (providing host and port) or fire a test cluster (default)
* - tests.rest.suite: comma separated paths of the test suites to be run (by default loaded from /rest-spec/test)
* - tests.rest.suite: comma separated paths of the test suites to be run (by default loaded from /rest-api-spec/test)
* it is possible to run only a subset of the tests providing a directory or a single yaml file
* (the default /rest-spec/test prefix is optional when files are loaded from classpath)
* - tests.rest.spec: REST spec path (default /rest-spec/api)
* (the default /rest-api-spec/test prefix is optional when files are loaded from classpath)
* - tests.rest.spec: REST spec path (default /rest-api-spec/api)
* - tests.iters: runs multiple iterations
* - tests.seed: seed to base the random behaviours on
* - tests.appendseed[true|false]: enables adding the seed to each test section's description (default false)
@ -87,8 +87,8 @@ public class RestTestSuiteRunner extends ParentRunner<RestTestCandidate> {
public static final String REST_TESTS_SUITE = "tests.rest.suite";
public static final String REST_TESTS_SPEC = "tests.rest.spec";
private static final String DEFAULT_TESTS_PATH = "/rest-spec/test";
private static final String DEFAULT_SPEC_PATH = "/rest-spec/api";
private static final String DEFAULT_TESTS_PATH = "/rest-api-spec/test";
private static final String DEFAULT_SPEC_PATH = "/rest-api-spec/api";
private static final int DEFAULT_ITERATIONS = 1;
private static final String PATHS_SEPARATOR = ",";

View File

@ -80,7 +80,7 @@ public final class FileUtils {
//try within classpath with and without file suffix (as it could be a single test suite)
URL resource = findResource(path, optionalFileSuffix);
if (resource == null) {
//try within classpath with optional prefix: /rest-spec/test (or /rest-test/api) is optional
//try within classpath with optional prefix: /rest-api-spec/test (or /rest-api-spec/api) is optional
String newPath = optionalPathPrefix + "/" + path;
resource = findResource(newPath, optionalFileSuffix);
if (resource == null) {

View File

@ -20,6 +20,7 @@ package org.elasticsearch.test.rest.test;
import org.elasticsearch.test.ElasticsearchTestCase;
import org.elasticsearch.test.rest.support.FileUtils;
import org.junit.Ignore;
import org.junit.Test;
import java.io.File;
@ -30,33 +31,34 @@ import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.Matchers.greaterThan;
@Ignore
public class FileUtilsTests extends ElasticsearchTestCase {
@Test
public void testLoadSingleYamlSuite() throws Exception {
Map<String,Set<File>> yamlSuites = FileUtils.findYamlSuites("/rest-spec/test", "/rest-spec/test/get/10_basic");
Map<String,Set<File>> yamlSuites = FileUtils.findYamlSuites("/rest-api-spec/test", "/rest-api-spec/test/get/10_basic");
assertSingleFile(yamlSuites, "get", "10_basic.yaml");
//the path prefix is optional
yamlSuites = FileUtils.findYamlSuites("/rest-spec/test", "get/10_basic.yaml");
yamlSuites = FileUtils.findYamlSuites("/rest-api-spec/test", "get/10_basic.yaml");
assertSingleFile(yamlSuites, "get", "10_basic.yaml");
//extension .yaml is optional
yamlSuites = FileUtils.findYamlSuites("/rest-spec/test", "get/10_basic");
yamlSuites = FileUtils.findYamlSuites("/rest-api-spec/test", "get/10_basic");
assertSingleFile(yamlSuites, "get", "10_basic.yaml");
}
@Test
public void testLoadMultipleYamlSuites() throws Exception {
//single directory
Map<String,Set<File>> yamlSuites = FileUtils.findYamlSuites("/rest-spec/test", "get");
Map<String,Set<File>> yamlSuites = FileUtils.findYamlSuites("/rest-api-spec/test", "get");
assertThat(yamlSuites, notNullValue());
assertThat(yamlSuites.size(), equalTo(1));
assertThat(yamlSuites.containsKey("get"), equalTo(true));
assertThat(yamlSuites.get("get").size(), greaterThan(1));
//multiple directories
yamlSuites = FileUtils.findYamlSuites("/rest-spec/test", "get", "index");
yamlSuites = FileUtils.findYamlSuites("/rest-api-spec/test", "get", "index");
assertThat(yamlSuites, notNullValue());
assertThat(yamlSuites.size(), equalTo(2));
assertThat(yamlSuites.containsKey("get"), equalTo(true));
@ -65,7 +67,7 @@ public class FileUtilsTests extends ElasticsearchTestCase {
assertThat(yamlSuites.get("index").size(), greaterThan(1));
//multiple paths, which can be both directories or yaml test suites (with optional file extension)
yamlSuites = FileUtils.findYamlSuites("/rest-spec/test", "get/10_basic", "index");
yamlSuites = FileUtils.findYamlSuites("/rest-api-spec/test", "get/10_basic", "index");
assertThat(yamlSuites, notNullValue());
assertThat(yamlSuites.size(), equalTo(2));
assertThat(yamlSuites.containsKey("get"), equalTo(true));
@ -80,7 +82,7 @@ public class FileUtilsTests extends ElasticsearchTestCase {
assertThat(file.createNewFile(), equalTo(true));
//load from directory outside of the classpath
yamlSuites = FileUtils.findYamlSuites("/rest-spec/test", "get/10_basic", dir.getAbsolutePath());
yamlSuites = FileUtils.findYamlSuites("/rest-api-spec/test", "get/10_basic", dir.getAbsolutePath());
assertThat(yamlSuites, notNullValue());
assertThat(yamlSuites.size(), equalTo(2));
assertThat(yamlSuites.containsKey("get"), equalTo(true));
@ -90,7 +92,7 @@ public class FileUtilsTests extends ElasticsearchTestCase {
assertSingleFile(yamlSuites.get(dir.getName()), dir.getName(), file.getName());
//load from external file (optional extension)
yamlSuites = FileUtils.findYamlSuites("/rest-spec/test", "get/10_basic", dir.getAbsolutePath() + File.separator + "test_loading");
yamlSuites = FileUtils.findYamlSuites("/rest-api-spec/test", "get/10_basic", dir.getAbsolutePath() + File.separator + "test_loading");
assertThat(yamlSuites, notNullValue());
assertThat(yamlSuites.size(), equalTo(2));
assertThat(yamlSuites.containsKey("get"), equalTo(true));