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}"/> <import file="${elasticsearch.integ.antfile.default}"/>
<property name="integ.args" value=" <!-- redefined to work with auth -->
-Des.cluster.name=${integ.cluster.name} <macrodef name="waitfor-elasticsearch">
-Des.http.port=${integ.http.port} <attribute name="port"/>
-Des.transport.tcp.port=${integ.transport.port} <attribute name="timeoutproperty"/>
-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}"/>
<sequential> <sequential>
<echo>Starting up external cluster...</echo> <echo>Waiting for elasticsearch to become available on port @{port}...</echo>
<run-script script="@{home}/bin/elasticsearch" spawn="true" <waitfor maxwait="30" maxwaitunit="second"
args="@{args} -Des.path.repo=@{home}/repo" /> checkevery="500" checkeveryunit="millisecond"
timeoutproperty="@{timeoutproperty}">
<waitfor maxwait="3" maxwaitunit="minute" checkevery="500"> <socket server="127.0.0.1" port="@{port}"/>
<socket server="127.0.0.1" port="${integ.http.port}"/>
</waitfor> </waitfor>
<local name="integ.pid"/>
<extract-pid file="${integ.pidfile}" property="integ.pid"/>
<echo>External cluster started PID ${integ.pid}</echo>
</sequential> </sequential>
</macrodef> </macrodef>
@ -42,9 +24,10 @@
<install-plugin name="${project.artifactId}" file="${project.build.directory}/releases/${project.artifactId}-${project.version}.zip"/> <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"/> <run-script script="${home}/bin/shield/esusers" args="useradd test_user -p changeme -r admin"/>
<startup-elasticsearch/> <startup-elasticsearch/>
<echo>Checking we can connect with basic auth on port ${integ.http.port}...</echo>
<local name="temp.file"/> <local name="temp.file"/>
<tempfile property="temp.file" destdir="${java.io.tmpdir}"/> <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> </target>
</project> </project>