test: make sure to stop nodes after the tribe node integration test

Original commit: elastic/x-pack-elasticsearch@3aaaced6ec
This commit is contained in:
Martijn van Groningen 2015-09-09 21:14:36 +02:00
parent 52c31d8c08
commit a6dc1ad97d
1 changed files with 25 additions and 21 deletions

View File

@ -25,10 +25,14 @@
<import file="${elasticsearch.integ.antfile.default}"/>
<import file="${elasticsearch.tools.directory}/ant/shield-overrides.xml"/>
<property name="integ.pidfile.2" location="${integ.scratch}/cluster2.pid"/>
<available property="integ.pidfile.2.exists" file="${integ.pidfile.2}"/>
<property name="integ.pidfile.3" location="${integ.scratch}/cluster3.pid"/>
<available property="integ.pidfile.3.exists" file="${integ.pidfile.3}"/>
<property name="tribe_node.pidfile" location="${integ.scratch}/tribe-node.pid"/>
<available property="tribe_node.pidfile.exists" file="${tribe_node.pidfile}"/>
<property name="cluster1.pidfile" location="${integ.scratch}/cluster1.pid"/>
<available property="cluster1.pidfile.exists" file="${cluster1.pidfile}"/>
<property name="cluster2.pidfile" location="${integ.scratch}/cluster2.pid"/>
<available property="cluster2.pidfile.exists" file="${cluster2.pidfile}"/>
<macrodef name="create-index">
<attribute name="name" />
@ -90,13 +94,13 @@
<ac:try>
<startup-elasticsearch es.transport.tcp.port="9600"
es.http.port="9700"
es.pidfile="${integ.pidfile.2}"
es.pidfile="${cluster1.pidfile}"
es.unicast.hosts="127.0.0.1:9600"
es.cluster.name="cluster1"/>
</ac:try>
<ac:catch>
<echo>Failed to start first cluster with message: ${failure.message}</echo>
<stop-node es.pidfile="${integ.pidfile.2}"/>
<echo>Failed to start cluster1 with message: ${failure.message}</echo>
<stop-node es.pidfile="${cluster1.pidfile}"/>
</ac:catch>
</ac:trycatch>
@ -104,14 +108,14 @@
<ac:try>
<startup-elasticsearch es.transport.tcp.port="9800"
es.http.port="9900"
es.pidfile="${integ.pidfile.3}"
es.pidfile="${cluster2.pidfile}"
es.unicast.hosts="127.0.0.1:9800"
es.cluster.name="cluster2"/>
</ac:try>
<ac:catch>
<echo>Failed to start second cluster with message: ${failure.message}</echo>
<stop-node es.pidfile="${integ.pidfile.3}"/>
<stop-node es.pidfile="${integ.pidfile.2}"/>
<echo>Failed to start cluster2 with message: ${failure.message}</echo>
<stop-node es.pidfile="${cluster1.pidfile}"/>
<stop-node es.pidfile="${cluster2.pidfile}"/>
</ac:catch>
</ac:trycatch>
@ -119,7 +123,7 @@
<ac:trycatch property="failure.message">
<ac:try>
<echo>Starting a tribe node, configured to connect to cluster1 and cluster2</echo>
<startup-elasticsearch>
<startup-elasticsearch es.pidfile="${tribe_node.pidfile}">
<additional-args>
<arg value="-Des.tribe.cluster1.cluster.name=cluster1"/>
<arg value="-Des.tribe.cluster1.discovery.zen.ping.unicast.hosts=127.0.0.1:9600"/>
@ -144,21 +148,21 @@
</ac:try>
<ac:catch>
<echo>Failed to start tribe node with message: ${failure.message}</echo>
<stop-node es.pidfile="${integ.pidfile}"/>
<stop-node es.pidfile="${integ.pidfile.3}"/>
<stop-node es.pidfile="${integ.pidfile.2}"/>
<stop-node es.pidfile="${tribe_node.pidfile}"/>
<stop-node es.pidfile="${cluster1.pidfile}"/>
<stop-node es.pidfile="${cluster2.pidfile}"/>
</ac:catch>
</ac:trycatch>
</target>
<target name="stop-tribe-node" if="integ.pidfile.exists">
<stop-node es.pidfile="${integ.pidfile}"/>
<target name="stop-tribe-node" if="tribe_node.pidfile.exists">
<stop-node es.pidfile="${tribe_node.pidfile}"/>
</target>
<target name="stop-cluster1" if="integ.pidfile.2.exists">
<stop-node es.pidfile="${integ.pidfile.2}"/>
<target name="stop-cluster1" if="cluster1.pidfile.exists">
<stop-node es.pidfile="${cluster1.pidfile}"/>
</target>
<target name="stop-cluster2" if="integ.pidfile.2.exists">
<stop-node es.pidfile="${integ.pidfile.3}"/>
<target name="stop-cluster2" if="cluster2.pidfile.exists">
<stop-node es.pidfile="${cluster2.pidfile}"/>
</target>
<target name="stop-tribe-node-and-all-clusters" depends="stop-tribe-node,stop-cluster1,stop-cluster2"/>