Move vagrant activation to a parameter

Closes #12611
This commit is contained in:
Nik Everett 2015-08-10 06:37:54 -04:00
parent f84552dc98
commit 999001746a
4 changed files with 50 additions and 42 deletions

View File

@ -327,7 +327,7 @@ vagrant plugin install vagrant-cachier
. Validate your installed dependencies:
-------------------------------------
mvn -Pvagrant -pl qa/vagrant validate
mvn -Dtests.vagrant -pl qa/vagrant validate
-------------------------------------
. Download the VMs. Since Maven or ant or something eats the progress reports
@ -350,22 +350,22 @@ done
. Smoke test the maven/ant dance that we use to get vagrant involved in
integration testing is working:
---------------------------------------------
mvn -Pvagrant,smoke-vms -pl qa/vagrant verify
mvn -Dtests.vagrant -Psmoke-vms -pl qa/vagrant verify
---------------------------------------------
or this to validate all the VMs:
-------------------------------------------------
mvn -Pvagrant,smoke-vms,all -pl qa/vagrant verify
mvn -Dtests.vagrant=all -Psmoke-vms -pl qa/vagrant verify
-------------------------------------------------
That will start up the VMs and then immediate quit.
. Finally run the tests. The fastest way to get this started is to run:
-----------------------------------
mvn clean install -DskipTests
mvn -Pvagrant -pl qa/vagrant verify
mvn -Dtests.vagrant -pl qa/vagrant verify
-----------------------------------
You could just run:
--------------------
mvn -Pvagrant verify
mvn -Dtests.vagrant verify
--------------------
but that will run all the tests. Which is probably a good thing, but not always
what you want.
@ -380,15 +380,15 @@ packaging and SyvVinit and systemd.
You can control the boxes that are used for testing like so. Run just
fedora-22 with:
--------------------------------------------
mvn -Pvagrant -pl qa/vagrant verify -DboxesToTest=fedora-22
mvn -Dtests.vagrant -pl qa/vagrant verify -DboxesToTest=fedora-22
--------------------------------------------
or run wheezy and trusty:
------------------------------------------------------------------
mvn -Pvagrant -pl qa/vagrant verify -DboxesToTest='wheezy, trusty'
mvn -Dtests.vagrant -pl qa/vagrant verify -DboxesToTest='wheezy, trusty'
------------------------------------------------------------------
or run all the boxes:
---------------------------------------
mvn -Pvagrant,all -pl qa/vagrant verify
mvn -Dtests.vagrant=all -pl qa/vagrant verify
---------------------------------------
Its important to know that if you ctrl-c any of these `mvn` runs that you'll
@ -483,7 +483,7 @@ If you wanted to retest all the release artifacts on a single VM you could:
# Build all the distributions fresh but skip recompiling elasticsearch:
mvn -amd -pl distribution install -DskipTests
# Copy them all the testroot
mvn -Pvagrant -pl qa/vagrant pre-integration-test
mvn -Dtests.vagrant -pl qa/vagrant pre-integration-test
vagrant up trusty && vagrant ssh trusty
cd $TESTROOT
sudo ES_CLEAN_BEFORE_TEST=true bats $BATS/*.bats

View File

@ -152,6 +152,11 @@
<profiles>
<profile>
<id>vagrant</id>
<activation>
<property>
<name>tests.vagrant</name>
</property>
</activation>
<modules>
<module>vagrant</module>
</modules>

View File

@ -23,15 +23,14 @@
<allDebBoxes>precise, trusty, vivid, wheezy, jessie</allDebBoxes>
<allRpmBoxes>centos-6, centos-7, fedora-22, oel-7</allRpmBoxes>
<debBoxes>trusty</debBoxes>
<rpmBoxes>centos-7</rpmBoxes>
<defaultDebBoxes>trusty</defaultDebBoxes>
<defaultRpmBoxes>centos-7</defaultRpmBoxes>
<!-- Unless rpmbuild is available on the host we can't test rpm based
boxes because we can't build the rpm and they fail without the rpm.
So to get good coverage you'll need to run this on a system with
rpmbuild installed - either osx via homebrew or fedora/centos/rhel.
-->
<proposedBoxesToTest>${debBoxes}</proposedBoxesToTest>
<!-- rpmbuild location : default to /usr/bin/rpmbuild -->
<packaging.rpm.rpmbuild>/usr/bin/rpmbuild</packaging.rpm.rpmbuild>
@ -140,7 +139,6 @@
<target unless="${skipTests}">
<taskdef resource="net/sf/antcontrib/antlib.xml"
classpathref="maven.dependency.classpath" />
<echo message="Running package tests on ${boxesToTest}"/>
<ant antfile="src/dev/ant/vagrant-integration-tests.xml"
target="vagrant-test-all-boxes"/>
</target>
@ -152,19 +150,6 @@
</build>
<profiles>
<!-- The following profiles change which boxes are run and whether or
not this build depends on the rpm artifact. We only depend on the
rpm artifact if this machine is capable of building it and we only
test on the rpm based distributions if the rpm is available
because the tests require it to be. -->
<profile>
<!-- Test on all boxes -->
<id>all</id>
<properties>
<debBoxes>${allDebBoxes}</debBoxes>
<rpmBoxes>${allRpmBoxes}</rpmBoxes>
</properties>
</profile>
<profile>
<!-- Enable the rpm artifact and rpm-boxes because we're on an
rpm-based distribution. -->
@ -210,7 +195,7 @@
</dependency>
</dependencies>
<properties>
<proposedBoxesToTest>${debBoxes}, ${rpmBoxes}</proposedBoxesToTest>
<rpmOk>ok</rpmOk>
</properties>
</profile>
<profile>
@ -250,20 +235,7 @@
</plugins>
</build>
<properties>
<proposedBoxesToTest>${debBoxes}, ${rpmBoxes}</proposedBoxesToTest>
</properties>
</profile>
<profile>
<!-- Only set boxesToTest if it hasn't been set on the command
line. -->
<id>set-boxes-to-test</id>
<activation>
<property>
<name>!boxesToTest</name>
</property>
</activation>
<properties>
<boxesToTest>${proposedBoxesToTest}</boxesToTest>
<rpmOk>ok</rpmOk>
</properties>
</profile>

View File

@ -1,10 +1,41 @@
<?xml version="1.0"?>
<project name="elasticsearch-integration-tests">
<target name="vagrant-test-all-boxes">
<target name="vagrant-test-all-boxes" depends="set-boxesToTest">
<echo message="Running package tests on ${boxesToTest}"/>
<foreach list="${boxesToTest}" trim="true" param="box"
target="vagrant-test" inheritall="true" inheritrefs="true"/>
</target>
<target name="set-boxesToTest">
<!-- If the user specifies the vagrant=all then try on all boxes. -->
<condition property="debBoxes" value="${allDebBoxes}"
else="${defaultDebBoxes}">
<equals arg1="${tests.vagrant}" arg2="all"/>
</condition>
<condition property="rpmBoxes" value="${allRpmBoxes}"
else="${defaultRpmBoxes}">
<equals arg1="${tests.vagrant}" arg2="all"/>
</condition>
<!-- By defaut only test on debian boxes because we always can build debs.
Only test on rpm based boxes if we can build RPM. -->
<condition property="proposedBoxesToTest" value="${debBoxes}, ${rpmBoxes}"
else="${debBoxes}">
<equals arg1="${rpmOk}" arg2="ok"/>
</condition>
<!-- Only use the proposedBoxesToTest list if the user did -Dtests.vagrant
or -Dtests.vagrant=all. Otherwise we assume they did
-Dtests.vagrant=somelistofboxes and we just set the boxesToTest to
that. If they set an rpm based box and don't have the rpm available
its on them. -->
<condition property="boxesToTest" value="${proposedBoxesToTest}"
else="${tests.vagrant}">
<or>
<equals arg1="${tests.vagrant}" arg2="true"/>
<equals arg1="${tests.vagrant}" arg2="all"/>
</or>
</condition>
</target>
<target name="vagrant-test" depends="vagrant-up">
<trycatch>
<try>