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: . 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 . 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 . Smoke test the maven/ant dance that we use to get vagrant involved in
integration testing is working: 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: 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. That will start up the VMs and then immediate quit.
. Finally run the tests. The fastest way to get this started is to run: . Finally run the tests. The fastest way to get this started is to run:
----------------------------------- -----------------------------------
mvn clean install -DskipTests mvn clean install -DskipTests
mvn -Pvagrant -pl qa/vagrant verify mvn -Dtests.vagrant -pl qa/vagrant verify
----------------------------------- -----------------------------------
You could just run: 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 but that will run all the tests. Which is probably a good thing, but not always
what you want. 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 You can control the boxes that are used for testing like so. Run just
fedora-22 with: 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: 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: 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 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: # Build all the distributions fresh but skip recompiling elasticsearch:
mvn -amd -pl distribution install -DskipTests mvn -amd -pl distribution install -DskipTests
# Copy them all the testroot # 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 vagrant up trusty && vagrant ssh trusty
cd $TESTROOT cd $TESTROOT
sudo ES_CLEAN_BEFORE_TEST=true bats $BATS/*.bats sudo ES_CLEAN_BEFORE_TEST=true bats $BATS/*.bats

View File

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

View File

@ -23,15 +23,14 @@
<allDebBoxes>precise, trusty, vivid, wheezy, jessie</allDebBoxes> <allDebBoxes>precise, trusty, vivid, wheezy, jessie</allDebBoxes>
<allRpmBoxes>centos-6, centos-7, fedora-22, oel-7</allRpmBoxes> <allRpmBoxes>centos-6, centos-7, fedora-22, oel-7</allRpmBoxes>
<debBoxes>trusty</debBoxes> <defaultDebBoxes>trusty</defaultDebBoxes>
<rpmBoxes>centos-7</rpmBoxes> <defaultRpmBoxes>centos-7</defaultRpmBoxes>
<!-- Unless rpmbuild is available on the host we can't test rpm based <!-- 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. 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 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. rpmbuild installed - either osx via homebrew or fedora/centos/rhel.
--> -->
<proposedBoxesToTest>${debBoxes}</proposedBoxesToTest>
<!-- rpmbuild location : default to /usr/bin/rpmbuild --> <!-- rpmbuild location : default to /usr/bin/rpmbuild -->
<packaging.rpm.rpmbuild>/usr/bin/rpmbuild</packaging.rpm.rpmbuild> <packaging.rpm.rpmbuild>/usr/bin/rpmbuild</packaging.rpm.rpmbuild>
@ -140,7 +139,6 @@
<target unless="${skipTests}"> <target unless="${skipTests}">
<taskdef resource="net/sf/antcontrib/antlib.xml" <taskdef resource="net/sf/antcontrib/antlib.xml"
classpathref="maven.dependency.classpath" /> classpathref="maven.dependency.classpath" />
<echo message="Running package tests on ${boxesToTest}"/>
<ant antfile="src/dev/ant/vagrant-integration-tests.xml" <ant antfile="src/dev/ant/vagrant-integration-tests.xml"
target="vagrant-test-all-boxes"/> target="vagrant-test-all-boxes"/>
</target> </target>
@ -152,19 +150,6 @@
</build> </build>
<profiles> <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> <profile>
<!-- Enable the rpm artifact and rpm-boxes because we're on an <!-- Enable the rpm artifact and rpm-boxes because we're on an
rpm-based distribution. --> rpm-based distribution. -->
@ -210,7 +195,7 @@
</dependency> </dependency>
</dependencies> </dependencies>
<properties> <properties>
<proposedBoxesToTest>${debBoxes}, ${rpmBoxes}</proposedBoxesToTest> <rpmOk>ok</rpmOk>
</properties> </properties>
</profile> </profile>
<profile> <profile>
@ -250,20 +235,7 @@
</plugins> </plugins>
</build> </build>
<properties> <properties>
<proposedBoxesToTest>${debBoxes}, ${rpmBoxes}</proposedBoxesToTest> <rpmOk>ok</rpmOk>
</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>
</properties> </properties>
</profile> </profile>

View File

@ -1,10 +1,41 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<project name="elasticsearch-integration-tests"> <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" <foreach list="${boxesToTest}" trim="true" param="box"
target="vagrant-test" inheritall="true" inheritrefs="true"/> target="vagrant-test" inheritall="true" inheritrefs="true"/>
</target> </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"> <target name="vagrant-test" depends="vagrant-up">
<trycatch> <trycatch>
<try> <try>