fix shield integ startup to be cleaner

Original commit: elastic/x-pack-elasticsearch@65bbc5b64a
This commit is contained in:
Robert Muir 2015-08-06 08:32:49 -04:00
parent fc7d0c017a
commit ef01b29158
1 changed files with 12 additions and 29 deletions

View File

@ -3,35 +3,17 @@
<import file="${elasticsearch.integ.antfile.default}"/>
<property name="integ.args" value="
-Des.cluster.name=${integ.cluster.name}
-Des.http.port=${integ.http.port}
-Des.transport.tcp.port=${integ.transport.port}
-Des.pidfile=${integ.pidfile}
-Des.discovery.zen.ping.multicast.enabled=false
-Des.script.inline=on
-Des.script.indexed=on
-Des.repositories.url.allowed_urls=http://snapshot.test*
"/>
<!-- TODO shield redefines this because the wait for http will fail due to auth -->
<!-- TODO: remove this, its really fragile as shit -->
<macrodef name="startup-elasticsearch">
<attribute name="home" default="${integ.scratch}/elasticsearch-${elasticsearch.version}"/>
<attribute name="args" default="${integ.args}"/>
<!-- redefined to work with auth -->
<macrodef name="waitfor-elasticsearch">
<attribute name="port"/>
<attribute name="timeoutproperty"/>
<sequential>
<echo>Starting up external cluster...</echo>
<run-script script="@{home}/bin/elasticsearch" spawn="true"
args="@{args} -Des.path.repo=@{home}/repo" />
<waitfor maxwait="3" maxwaitunit="minute" checkevery="500">
<socket server="127.0.0.1" port="${integ.http.port}"/>
<echo>Waiting for elasticsearch to become available on port @{port}...</echo>
<waitfor maxwait="30" maxwaitunit="second"
checkevery="500" checkeveryunit="millisecond"
timeoutproperty="@{timeoutproperty}">
<socket server="127.0.0.1" port="@{port}"/>
</waitfor>
<local name="integ.pid"/>
<extract-pid file="${integ.pidfile}" property="integ.pid"/>
<echo>External cluster started PID ${integ.pid}</echo>
</sequential>
</macrodef>
@ -42,9 +24,10 @@
<install-plugin name="${project.artifactId}" file="${project.build.directory}/releases/${project.artifactId}-${project.version}.zip"/>
<run-script script="${home}/bin/shield/esusers" args="useradd test_user -p changeme -r admin"/>
<startup-elasticsearch/>
<echo>Checking we can connect with basic auth on port ${integ.http.port}...</echo>
<local name="temp.file"/>
<tempfile property="temp.file" destdir="${java.io.tmpdir}"/>
<get src="http://127.0.0.1:${integ.http.port}" dest="${temp.file}" username="test_user" password="changeme" verbose="true" retries="10"/>
<get src="http://127.0.0.1:${integ.http.port}" dest="${temp.file}"
username="test_user" password="changeme" verbose="true" retries="10"/>
</target>
</project>