Factor out waiting for easier redefinition

This commit is contained in:
Robert Muir 2015-08-06 08:28:08 -04:00
parent 6f13171d50
commit 57b1b72af6

View File

@ -110,6 +110,20 @@
</sequential>
</macrodef>
<!-- waits for elasticsearch to start -->
<macrodef name="waitfor-elasticsearch">
<attribute name="port"/>
<attribute name="timeoutproperty"/>
<sequential>
<echo>Waiting for elasticsearch to become available on port @{port}...</echo>
<waitfor maxwait="30" maxwaitunit="second"
checkevery="500" checkeveryunit="millisecond"
timeoutproperty="@{timeoutproperty}">
<http url="http://127.0.0.1:@{port}"/>
</waitfor>
</sequential>
</macrodef>
<!-- start elasticsearch and wait until its ready -->
<macrodef name="startup-elasticsearch">
<attribute name="home" default="${integ.scratch}/elasticsearch-${elasticsearch.version}"/>
@ -148,12 +162,10 @@
</nested>
</run-script>
<!-- wait for startup -->
<local name="failed.to.start"/>
<waitfor maxwait="30" maxwaitunit="second"
checkevery="500" checkeveryunit="millisecond"
timeoutproperty="failed.to.start">
<http url="http://127.0.0.1:@{es.http.port}"/>
</waitfor>
<waitfor-elasticsearch port="@{es.http.port}"
timeoutproperty="failed.to.start"/>
<!-- best effort, print console log. useful if it fails especially -->
<local name="log.contents"/>