2015-09-02 17:16:07 -04:00
|
|
|
<?xml version="1.0"?>
|
|
|
|
<!--
|
|
|
|
~ ELASTICSEARCH CONFIDENTIAL
|
|
|
|
~ __________________
|
|
|
|
~
|
|
|
|
~ [2014] Elasticsearch Incorporated. All Rights Reserved.
|
|
|
|
~
|
|
|
|
~ NOTICE: All information contained herein is, and remains
|
|
|
|
~ the property of Elasticsearch Incorporated and its suppliers,
|
|
|
|
~ if any. The intellectual and technical concepts contained
|
|
|
|
~ herein are proprietary to Elasticsearch Incorporated
|
|
|
|
~ and its suppliers and may be covered by U.S. and Foreign Patents,
|
|
|
|
~ patents in process, and are protected by trade secret or copyright law.
|
|
|
|
~ Dissemination of this information or reproduction of this material
|
|
|
|
~ is strictly forbidden unless prior written permission is obtained
|
|
|
|
~ from Elasticsearch Incorporated.
|
|
|
|
-->
|
|
|
|
|
|
|
|
<project name="smoke-test-tribe-node-with-shield"
|
|
|
|
xmlns:ac="antlib:net.sf.antcontrib">
|
|
|
|
|
|
|
|
<taskdef name="xhttp" classname="org.elasticsearch.ant.HttpTask" classpath="${test_classpath}" />
|
|
|
|
<typedef name="xhttp" classname="org.elasticsearch.ant.HttpCondition" classpath="${test_classpath}"/>
|
|
|
|
|
|
|
|
<import file="${elasticsearch.integ.antfile.default}"/>
|
|
|
|
<import file="${elasticsearch.tools.directory}/ant/shield-overrides.xml"/>
|
|
|
|
|
2015-09-09 15:14:36 -04:00
|
|
|
<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}"/>
|
2015-09-02 17:16:07 -04:00
|
|
|
|
|
|
|
<macrodef name="create-index">
|
|
|
|
<attribute name="name" />
|
|
|
|
<attribute name="port" />
|
|
|
|
<sequential>
|
|
|
|
<xhttp uri="http://127.0.0.1:@{port}/@{name}" method="PUT" username="test_admin" password="changeme" />
|
|
|
|
<waitfor maxwait="30" maxwaitunit="second"
|
|
|
|
checkevery="500" checkeveryunit="millisecond"
|
|
|
|
timeoutproperty="@{timeoutproperty}">
|
|
|
|
<xhttp uri="http://127.0.0.1:@{port}/_cluster/health/@{name}?wait_for_status=yellow" username="test_admin" password="changeme" />
|
|
|
|
</waitfor>
|
|
|
|
</sequential>
|
|
|
|
</macrodef>
|
|
|
|
|
|
|
|
<target name="start-tribe-node-and-2-clusters-with-shield" depends="setup-workspace">
|
|
|
|
<ac:for list="${xplugins.list}" param="xplugin.name">
|
|
|
|
<sequential>
|
|
|
|
<fail message="Expected @{xplugin.name}-${version}.zip as a dependency, but could not be found in ${integ.deps}/plugins}">
|
|
|
|
<condition>
|
|
|
|
<not>
|
|
|
|
<available file="${integ.deps}/plugins/@{xplugin.name}-${elasticsearch.version}.zip"/>
|
|
|
|
</not>
|
|
|
|
</condition>
|
|
|
|
</fail>
|
|
|
|
</sequential>
|
|
|
|
</ac:for>
|
|
|
|
|
|
|
|
<ac:for param="file">
|
|
|
|
<path>
|
|
|
|
<fileset dir="${integ.deps}/plugins"/>
|
|
|
|
</path>
|
|
|
|
<sequential>
|
|
|
|
<local name="plugin.name"/>
|
|
|
|
<convert-plugin-name file="@{file}" outputproperty="plugin.name"/>
|
|
|
|
<install-plugin name="${plugin.name}" file="@{file}"/>
|
|
|
|
</sequential>
|
|
|
|
</ac:for>
|
|
|
|
|
|
|
|
<local name="home"/>
|
|
|
|
<property name="home" location="${integ.scratch}/elasticsearch-${elasticsearch.version}"/>
|
|
|
|
|
|
|
|
<echo>Adding roles.yml</echo>
|
|
|
|
<copy file="shield-roles.yml" tofile="${home}/config/shield/roles.yml" overwrite="true"/>
|
|
|
|
|
|
|
|
<echo>Adding shield users...</echo>
|
|
|
|
<run-script script="${home}/bin/shield/esusers">
|
|
|
|
<nested>
|
|
|
|
<arg value="useradd"/>
|
|
|
|
<arg value="test_admin"/>
|
|
|
|
<arg value="-p"/>
|
|
|
|
<arg value="changeme"/>
|
|
|
|
<arg value="-r"/>
|
|
|
|
<arg value="admin"/>
|
|
|
|
</nested>
|
|
|
|
</run-script>
|
|
|
|
|
|
|
|
<echo>Starting two nodes, each node in a different cluster</echo>
|
|
|
|
<ac:trycatch property="failure.message">
|
|
|
|
<ac:try>
|
|
|
|
<startup-elasticsearch es.transport.tcp.port="9600"
|
|
|
|
es.http.port="9700"
|
2015-09-09 15:14:36 -04:00
|
|
|
es.pidfile="${cluster1.pidfile}"
|
2015-09-02 17:16:07 -04:00
|
|
|
es.unicast.hosts="127.0.0.1:9600"
|
|
|
|
es.cluster.name="cluster1"/>
|
|
|
|
</ac:try>
|
|
|
|
<ac:catch>
|
2015-09-09 15:14:36 -04:00
|
|
|
<echo>Failed to start cluster1 with message: ${failure.message}</echo>
|
|
|
|
<stop-node es.pidfile="${cluster1.pidfile}"/>
|
2015-09-02 17:16:07 -04:00
|
|
|
</ac:catch>
|
|
|
|
</ac:trycatch>
|
|
|
|
|
|
|
|
<ac:trycatch property="failure.message">
|
|
|
|
<ac:try>
|
|
|
|
<startup-elasticsearch es.transport.tcp.port="9800"
|
|
|
|
es.http.port="9900"
|
2015-09-09 15:14:36 -04:00
|
|
|
es.pidfile="${cluster2.pidfile}"
|
2015-09-02 17:16:07 -04:00
|
|
|
es.unicast.hosts="127.0.0.1:9800"
|
|
|
|
es.cluster.name="cluster2"/>
|
|
|
|
</ac:try>
|
|
|
|
<ac:catch>
|
2015-09-09 15:14:36 -04:00
|
|
|
<echo>Failed to start cluster2 with message: ${failure.message}</echo>
|
|
|
|
<stop-node es.pidfile="${cluster1.pidfile}"/>
|
|
|
|
<stop-node es.pidfile="${cluster2.pidfile}"/>
|
2015-09-02 17:16:07 -04:00
|
|
|
</ac:catch>
|
|
|
|
</ac:trycatch>
|
|
|
|
|
|
|
|
|
|
|
|
<ac:trycatch property="failure.message">
|
|
|
|
<ac:try>
|
|
|
|
<echo>Starting a tribe node, configured to connect to cluster1 and cluster2</echo>
|
2015-09-09 15:14:36 -04:00
|
|
|
<startup-elasticsearch es.pidfile="${tribe_node.pidfile}">
|
2015-09-02 17:16:07 -04:00
|
|
|
<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"/>
|
|
|
|
|
|
|
|
<arg value="-Des.tribe.cluster2.cluster.name=cluster2"/>
|
|
|
|
<arg value="-Des.tribe.cluster2.discovery.zen.ping.unicast.hosts=127.0.0.1:9800"/>
|
|
|
|
</additional-args>
|
|
|
|
</startup-elasticsearch>
|
|
|
|
<xhttp uri="http://127.0.0.1:${integ.http.port}/_cluster/health?wait_for_nodes=5" username="test_admin" password="changeme" />
|
|
|
|
|
|
|
|
<!--
|
|
|
|
From the rest tests we only connect to the tribe node, so we need create the indices externally:
|
|
|
|
|
|
|
|
By creating the index after the tribe node has started we can be sure that the tribe node knows
|
|
|
|
about it. See: https://github.com/elastic/elasticsearch/issues/13292
|
|
|
|
-->
|
|
|
|
<echo>Creating index1 in cluster1</echo>
|
|
|
|
<create-index name="index1" port="9700"/>
|
|
|
|
|
|
|
|
<echo>Creating index2 in cluster2</echo>
|
|
|
|
<create-index name="index2" port="9900"/>
|
|
|
|
</ac:try>
|
|
|
|
<ac:catch>
|
|
|
|
<echo>Failed to start tribe node with message: ${failure.message}</echo>
|
2015-09-09 15:14:36 -04:00
|
|
|
<stop-node es.pidfile="${tribe_node.pidfile}"/>
|
|
|
|
<stop-node es.pidfile="${cluster1.pidfile}"/>
|
|
|
|
<stop-node es.pidfile="${cluster2.pidfile}"/>
|
2015-09-02 17:16:07 -04:00
|
|
|
</ac:catch>
|
|
|
|
</ac:trycatch>
|
|
|
|
</target>
|
|
|
|
|
2015-09-09 15:14:36 -04:00
|
|
|
<target name="stop-tribe-node" if="tribe_node.pidfile.exists">
|
|
|
|
<stop-node es.pidfile="${tribe_node.pidfile}"/>
|
2015-09-02 17:16:07 -04:00
|
|
|
</target>
|
2015-09-09 15:14:36 -04:00
|
|
|
<target name="stop-cluster1" if="cluster1.pidfile.exists">
|
|
|
|
<stop-node es.pidfile="${cluster1.pidfile}"/>
|
2015-09-02 17:16:07 -04:00
|
|
|
</target>
|
2015-09-09 15:14:36 -04:00
|
|
|
<target name="stop-cluster2" if="cluster2.pidfile.exists">
|
|
|
|
<stop-node es.pidfile="${cluster2.pidfile}"/>
|
2015-09-02 17:16:07 -04:00
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="stop-tribe-node-and-all-clusters" depends="stop-tribe-node,stop-cluster1,stop-cluster2"/>
|
|
|
|
|
|
|
|
</project>
|