Get delete by query rest tests running

This commit is contained in:
Robert Muir 2015-07-06 15:13:50 -04:00
parent 75285cee88
commit 9a146b9e75
4 changed files with 132 additions and 8 deletions

View File

@ -1,42 +1,74 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<project name="elasticsearch-integration-tests"> <project name="elasticsearch-integration-tests">
<!-- runs an OS script -->
<macrodef name="run-script"> <macrodef name="run-script">
<attribute name="script"/> <attribute name="script"/>
<attribute name="dir"/> <attribute name="dir"/>
<attribute name="args"/> <attribute name="args"/>
<attribute name="spawn"/>
<sequential> <sequential>
<exec executable="cmd" osfamily="winnt" dir="@{dir}" spawn="true"> <exec executable="cmd" osfamily="winnt" dir="@{dir}" spawn="@{spawn}">
<arg value="/c"/> <arg value="/c"/>
<arg value="@{dir}/@{script}.bat"/> <arg value="@{dir}/@{script}.bat"/>
<arg line="@{args}"/> <arg line="@{args}"/>
</exec> </exec>
<exec executable="sh" osfamily="unix" dir="@{dir}" spawn="true"> <exec executable="sh" osfamily="unix" dir="@{dir}" spawn="@{spawn}">
<arg value="@{dir}/@{script}"/> <arg value="@{dir}/@{script}"/>
<arg line="@{args}"/> <arg line="@{args}"/>
</exec> </exec>
</sequential> </sequential>
</macrodef> </macrodef>
<!-- unzip release artifact --> <!-- unzip core release artifact and start ES -->
<target name="start-external-cluster"> <target name="start-external-cluster">
<property name="integ.finalname" value="${project.artifactId}-${project.version}"/> <property name="integ.finalname" value="${project.artifactId}-${project.version}"/>
<property name="integ.scratch" location="${project.build.directory}/integ-tests"/> <property name="integ.scratch" location="${project.build.directory}/integ-tests"/>
<unzip src="${project.build.directory}/releases/${integ.finalname}.zip" <unzip src="${project.build.directory}/releases/${integ.finalname}.zip"
dest="${integ.scratch}"/> dest="${integ.scratch}"/>
<property name="integ.home" location="${integ.scratch}/${integ.finalname}"/> <property name="integ.home" location="${integ.scratch}/${integ.finalname}"/>
<property name="integ.repo.home" location="${integ.home}/repo"/>
<!-- execute -->
<property name="integ.args" <property name="integ.args"
value="-Des.node.name=smoke_tester -Des.cluster.name=prepare_release value="-Des.node.name=smoke_tester -Des.cluster.name=prepare_release
-Des.discovery.zen.ping.multicast.enabled=false -Des.script.inline=on -Des.discovery.zen.ping.multicast.enabled=false -Des.script.inline=on
-Des.script.indexed=on"/> -Des.script.indexed=on -Des.path.repo=${integ.repo.home}"/>
<!-- execute -->
<echo>Starting up external cluster...</echo> <echo>Starting up external cluster...</echo>
<run-script dir="${integ.home}" script="bin/elasticsearch" args="${integ.args}" spawn="true"/>
<run-script dir="${integ.home}" script="bin/elasticsearch" args="${integ.args}"/> <waitfor maxwait="3" maxwaitunit="minute" checkevery="500">
<http url="http://127.0.0.1:9200"/>
</waitfor>
<echo>External cluster started</echo>
</target>
<!-- unzip core release artifact, install plugin, then start ES -->
<target name="start-external-cluster-with-plugin">
<property name="integ.scratch" location="${project.build.directory}/integ-tests"/>
<unzip src="${settings.localRepository}/org/elasticsearch/elasticsearch/${elasticsearch.version}/elasticsearch-${elasticsearch.version}.zip"
dest="${integ.scratch}"/>
<property name="integ.home" location="${integ.scratch}/elasticsearch-${elasticsearch.version}"/>
<property name="integ.repo.home" location="${integ.home}/repo"/>
<property name="integ.args"
value="-Des.node.name=smoke_tester -Des.cluster.name=prepare_release
-Des.discovery.zen.ping.multicast.enabled=false -Des.script.inline=on
-Des.script.indexed=on -Des.path.repo=${integ.repo.home}"/>
<makeurl property="integ.plugin.url" file="${project.build.directory}/releases/${project.artifactId}-${project.version}.zip"/>
<echo>Installing plugin ${project.artifactId}...</echo>
<run-script dir="${integ.home}" script="bin/plugin" args="-u ${integ.plugin.url} -i ${project.artifactId}/${project.version}" spawn="false"/>
<!-- execute -->
<echo>Starting up external cluster...</echo>
<run-script dir="${integ.home}" script="bin/elasticsearch" args="${integ.args}" spawn="true"/>
<waitfor maxwait="3" maxwaitunit="minute" checkevery="500"> <waitfor maxwait="3" maxwaitunit="minute" checkevery="500">
<http url="http://127.0.0.1:9200"/> <http url="http://127.0.0.1:9200"/>

View File

@ -0,0 +1,41 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.plugin.deletebyquery.test.rest;
import com.carrotsearch.randomizedtesting.annotations.Name;
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
import org.elasticsearch.test.rest.ElasticsearchRestTestCase;
import org.elasticsearch.test.rest.RestTestCandidate;
import org.elasticsearch.test.rest.parser.RestTestParseException;
import java.io.IOException;
public class DeleteByQueryRestIT extends ElasticsearchRestTestCase {
public DeleteByQueryRestIT(@Name("yaml") RestTestCandidate testCandidate) {
super(testCandidate);
}
@ParametersFactory
public static Iterable<Object[]> parameters() throws IOException, RestTestParseException {
return ElasticsearchRestTestCase.createParameters(0, 1);
}
}

View File

@ -288,6 +288,53 @@
</testResource> </testResource>
</testResources> </testResources>
<plugins>
<!-- integration tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<!-- start up external cluster -->
<execution>
<id>integ-setup</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<ant antfile="${elasticsearch.tools.directory}/ant/integration-tests.xml"
target="start-external-cluster-with-plugin"/>
</target>
</configuration>
</execution>
<!-- shut down external cluster -->
<execution>
<id>integ-teardown</id>
<phase>post-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<ant antfile="${elasticsearch.tools.directory}/ant/integration-tests.xml"
target="stop-external-cluster"/>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<tests.cluster>127.0.0.1:9300</tests.cluster>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
<pluginManagement> <pluginManagement>
<plugins> <plugins>
<plugin> <plugin>

View File

@ -94,10 +94,10 @@
<tests.rest.suite></tests.rest.suite> <tests.rest.suite></tests.rest.suite>
<tests.rest.blacklist></tests.rest.blacklist> <tests.rest.blacklist></tests.rest.blacklist>
<tests.rest.spec></tests.rest.spec> <tests.rest.spec></tests.rest.spec>
<tests.rest.load_packaged></tests.rest.load_packaged>
<tests.network></tests.network> <tests.network></tests.network>
<tests.cluster></tests.cluster> <tests.cluster></tests.cluster>
<tests.filter></tests.filter> <tests.filter></tests.filter>
<tests.rest.load_packaged></tests.rest.load_packaged>
<env.ES_TEST_LOCAL></env.ES_TEST_LOCAL> <env.ES_TEST_LOCAL></env.ES_TEST_LOCAL>
<tests.security.manager>true</tests.security.manager> <tests.security.manager>true</tests.security.manager>
<tests.compatibility></tests.compatibility> <tests.compatibility></tests.compatibility>
@ -701,6 +701,10 @@
<skipTests>${skip.integ.tests}</skipTests> <skipTests>${skip.integ.tests}</skipTests>
<systemPropertyVariables> <systemPropertyVariables>
<es.logger.level>${es.logger.level}</es.logger.level> <es.logger.level>${es.logger.level}</es.logger.level>
<tests.rest.suite>${tests.rest.suite}</tests.rest.suite>
<tests.rest.blacklist>${tests.rest.blacklist}</tests.rest.blacklist>
<tests.rest.spec>${tests.rest.spec}</tests.rest.spec>
<tests.rest.load_packaged>${tests.rest.load_packaged}</tests.rest.load_packaged>
</systemPropertyVariables> </systemPropertyVariables>
</configuration> </configuration>
<executions> <executions>