From d1bc099c91ee81db4183a60a034b0620700dd30d Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Tue, 11 Aug 2015 00:03:15 +0200 Subject: [PATCH] Add multi-node IT infrastructure This adds the infrastrucutre to run integration tests with more than one node. * it adds relevant macros and targets to integration-tests.xml to start unicast nodes * there is a qa/smoke-test-multinode project that simulates such a setup this commit is soely the infrastructure and doesn't hook up any projects to use this. For reliability and stability reasons this should be used with care and only if it's really needed. Closes #12718 --- .../main/resources/ant/integration-tests.xml | 71 +++- pom.xml | 2 + qa/smoke-test-multinode/integration-tests.xml | 42 +++ qa/smoke-test-multinode/pom.xml | 305 ++++++++++++++++++ .../test/smoke_test_multinode/10_basic.yaml | 26 ++ .../smoketest/SmokeTestMultiIT.java | 41 +++ 6 files changed, 470 insertions(+), 17 deletions(-) create mode 100644 qa/smoke-test-multinode/integration-tests.xml create mode 100644 qa/smoke-test-multinode/pom.xml create mode 100644 qa/smoke-test-multinode/rest-api-spec/test/smoke_test_multinode/10_basic.yaml create mode 100644 qa/smoke-test-multinode/src/test/java/org/elasticsearch/smoketest/SmokeTestMultiIT.java diff --git a/dev-tools/src/main/resources/ant/integration-tests.xml b/dev-tools/src/main/resources/ant/integration-tests.xml index dfe6ce41272..30ceea60862 100644 --- a/dev-tools/src/main/resources/ant/integration-tests.xml +++ b/dev-tools/src/main/resources/ant/integration-tests.xml @@ -1,6 +1,5 @@ - @@ -124,11 +123,27 @@ + + + + + + Waiting for elasticsearch to form a cluster of two... + + + + + + + + @@ -146,6 +161,8 @@ -Des.pidfile=@{es.pidfile} -Des.path.repo=@{home}/repo -Des.discovery.zen.ping.multicast.enabled=false +-Des.discovery.zen.ping.unicast.enabled=@{es.unicast.enabled} +-Des.discovery.zen.ping.unicast.hosts=@{es.unicast.hosts} -Des.script.inline=on -Des.script.indexed=on -Des.repositories.url.allowed_urls=http://snapshot.test* @@ -183,7 +200,7 @@ - External cluster started PID ${integ.pid} + External node started PID ${integ.pid} @@ -205,6 +222,40 @@ + + + + + + + Shutting down external node PID ${integ.pid} + + + + + + + + + + + + + + + + + + + + + + + + + @@ -233,21 +284,7 @@ - - - - Shutting down external cluster PID ${integ.pid} - - - - - - - - - - - + diff --git a/pom.xml b/pom.xml index 4b3cef39c8d..6db374e0717 100644 --- a/pom.xml +++ b/pom.xml @@ -115,6 +115,8 @@ ${integ.scratch}/temp 9400 9500 + 9600 + 9700 \bno(n|)commit\b diff --git a/qa/smoke-test-multinode/integration-tests.xml b/qa/smoke-test-multinode/integration-tests.xml new file mode 100644 index 00000000000..cd9706bde7b --- /dev/null +++ b/qa/smoke-test-multinode/integration-tests.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + Failed to start second node with message: ${failure.message} + + + + + + + + + + + + + + + + diff --git a/qa/smoke-test-multinode/pom.xml b/qa/smoke-test-multinode/pom.xml new file mode 100644 index 00000000000..20dfb385b08 --- /dev/null +++ b/qa/smoke-test-multinode/pom.xml @@ -0,0 +1,305 @@ + + + + 4.0.0 + + + org.elasticsearch.qa + elasticsearch-qa + 2.0.0-beta1-SNAPSHOT + + + + + smoke-test-multinode + QA: Smoke Test Multi-Node IT + Tests that multi node IT tests work + + + true + ${project.basedir}/integration-tests.xml + smoke_test_multinode + false + + + + org.elasticsearch + elasticsearch + test-jar + test + + + + + org.elasticsearch + elasticsearch + provided + + + org.apache.lucene + lucene-core + provided + + + org.apache.lucene + lucene-backward-codecs + provided + + + org.apache.lucene + lucene-analyzers-common + provided + + + org.apache.lucene + lucene-queries + provided + + + org.apache.lucene + lucene-memory + provided + + + org.apache.lucene + lucene-highlighter + provided + + + org.apache.lucene + lucene-queryparser + provided + + + org.apache.lucene + lucene-suggest + provided + + + org.apache.lucene + lucene-join + provided + + + org.apache.lucene + lucene-spatial + provided + + + org.apache.lucene + lucene-expressions + provided + + + com.spatial4j + spatial4j + provided + + + com.vividsolutions + jts + provided + + + com.github.spullara.mustache.java + compiler + provided + + + com.google.guava + guava + provided + + + com.carrotsearch + hppc + provided + + + joda-time + joda-time + provided + + + org.joda + joda-convert + provided + + + com.fasterxml.jackson.core + jackson-core + provided + + + com.fasterxml.jackson.dataformat + jackson-dataformat-smile + provided + + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + provided + + + com.fasterxml.jackson.dataformat + jackson-dataformat-cbor + provided + + + io.netty + netty + provided + + + com.ning + compress-lzf + provided + + + com.tdunning + t-digest + provided + + + org.apache.commons + commons-lang3 + provided + + + commons-cli + commons-cli + provided + + + org.codehaus.groovy + groovy-all + indy + provided + + + log4j + log4j + provided + + + log4j + apache-log4j-extras + provided + + + org.slf4j + slf4j-api + provided + + + net.java.dev.jna + jna + provided + + + + + + org.apache.httpcomponents + httpclient + test + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + integ-setup-dependencies + pre-integration-test + + copy + + + ${skip.integ.tests} + true + ${integ.deps}/plugins + + + + + org.elasticsearch.distribution.zip + elasticsearch + ${elasticsearch.version} + zip + true + ${integ.deps} + + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + + + + integ-setup + pre-integration-test + + run + + + + + + + + + ${skip.integ.tests} + + + + + integ-teardown + post-integration-test + + run + + + + + + ${skip.integ.tests} + + + + + + ant-contrib + ant-contrib + 1.0b3 + + + ant + ant + + + + + org.apache.ant + ant-nodeps + 1.8.1 + + + + + + + diff --git a/qa/smoke-test-multinode/rest-api-spec/test/smoke_test_multinode/10_basic.yaml b/qa/smoke-test-multinode/rest-api-spec/test/smoke_test_multinode/10_basic.yaml new file mode 100644 index 00000000000..74066ebf6b1 --- /dev/null +++ b/qa/smoke-test-multinode/rest-api-spec/test/smoke_test_multinode/10_basic.yaml @@ -0,0 +1,26 @@ +# Integration tests for smoke testing multi-node IT +# +--- +"cluster health basic test, one index": + - do: + indices.create: + index: test_index + body: + settings: + index: + number_of_replicas: 1 + + - do: + cluster.health: + wait_for_status: green + + - is_true: cluster_name + - is_false: timed_out + - gte: { number_of_nodes: 2 } + - gte: { number_of_data_nodes: 2 } + - gt: { active_primary_shards: 0 } + - gt: { active_shards: 0 } + - gte: { relocating_shards: 0 } + - match: { initializing_shards: 0 } + - match: { unassigned_shards: 0 } + - gte: { number_of_pending_tasks: 0 } diff --git a/qa/smoke-test-multinode/src/test/java/org/elasticsearch/smoketest/SmokeTestMultiIT.java b/qa/smoke-test-multinode/src/test/java/org/elasticsearch/smoketest/SmokeTestMultiIT.java new file mode 100644 index 00000000000..75c4633e632 --- /dev/null +++ b/qa/smoke-test-multinode/src/test/java/org/elasticsearch/smoketest/SmokeTestMultiIT.java @@ -0,0 +1,41 @@ +/* + * Licensed to Elasticsearch under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.elasticsearch.smoketest; + +import com.carrotsearch.randomizedtesting.annotations.Name; +import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; +import org.elasticsearch.test.rest.ESRestTestCase; +import org.elasticsearch.test.rest.RestTestCandidate; +import org.elasticsearch.test.rest.parser.RestTestParseException; + +import java.io.IOException; + +public class SmokeTestMultiIT extends ESRestTestCase { + + public SmokeTestMultiIT(@Name("yaml") RestTestCandidate testCandidate) { + super(testCandidate); + } + + @ParametersFactory + public static Iterable parameters() throws IOException, RestTestParseException { + return ESRestTestCase.createParameters(0, 1); + } +} +