diff --git a/core/src/main/java/org/elasticsearch/ElasticsearchException.java b/core/src/main/java/org/elasticsearch/ElasticsearchException.java index e7fe791ff97..0a23ebd4937 100644 --- a/core/src/main/java/org/elasticsearch/ElasticsearchException.java +++ b/core/src/main/java/org/elasticsearch/ElasticsearchException.java @@ -43,7 +43,10 @@ import java.util.*; */ public class ElasticsearchException extends RuntimeException implements ToXContent { - public static final String REST_EXCEPTION_SKIP_CAUSE = "rest.exception.skip_cause"; + public static final String REST_EXCEPTION_SKIP_CAUSE = "rest.exception.cause.skip"; + public static final String REST_EXCEPTION_SKIP_STACK_TRACE = "rest.exception.stacktrace.skip"; + private static final boolean REST_EXCEPTION_SKIP_STACK_TRACE_DEFAULT = false; + private static final boolean REST_EXCEPTION_SKIP_CAUSE_DEFAULT = false; private static final String INDEX_HEADER_KEY = "es.index"; private static final String SHARD_HEADER_KEY = "es.shard"; private static final String RESOURCE_HEADER_TYPE_KEY = "es.resource.type"; @@ -270,6 +273,9 @@ public class ElasticsearchException extends RuntimeException implements ToXConte } innerToXContent(builder, params); renderHeader(builder, params); + if (params.paramAsBoolean(REST_EXCEPTION_SKIP_STACK_TRACE, REST_EXCEPTION_SKIP_STACK_TRACE_DEFAULT) == false) { + builder.field("stack_trace", ExceptionsHelper.stackTrace(this)); + } } return builder; } @@ -286,7 +292,7 @@ public class ElasticsearchException extends RuntimeException implements ToXConte */ protected final void causeToXContent(XContentBuilder builder, Params params) throws IOException { final Throwable cause = getCause(); - if (cause != null && params.paramAsBoolean(REST_EXCEPTION_SKIP_CAUSE, false) == false) { + if (cause != null && params.paramAsBoolean(REST_EXCEPTION_SKIP_CAUSE, REST_EXCEPTION_SKIP_CAUSE_DEFAULT) == false) { builder.field("caused_by"); builder.startObject(); toXContent(builder, params, cause); @@ -342,6 +348,9 @@ public class ElasticsearchException extends RuntimeException implements ToXConte toXContent(builder, params, ex.getCause()); builder.endObject(); } + if (params.paramAsBoolean(REST_EXCEPTION_SKIP_STACK_TRACE, REST_EXCEPTION_SKIP_STACK_TRACE_DEFAULT) == false) { + builder.field("stack_trace", ExceptionsHelper.stackTrace(ex)); + } } } diff --git a/core/src/main/java/org/elasticsearch/index/query/SimpleQueryStringBuilder.java b/core/src/main/java/org/elasticsearch/index/query/SimpleQueryStringBuilder.java index 087fedd67ba..20011557156 100644 --- a/core/src/main/java/org/elasticsearch/index/query/SimpleQueryStringBuilder.java +++ b/core/src/main/java/org/elasticsearch/index/query/SimpleQueryStringBuilder.java @@ -263,10 +263,9 @@ public class SimpleQueryStringBuilder extends AbstractQueryBuilder fieldsAndWeights = new HashMap<>(); Operator defaultOperator = null; @@ -108,9 +116,7 @@ public class SimpleQueryStringParser extends BaseQueryParser { fieldsAndWeights.put(fField, fBoost); } } else { - throw new QueryParsingException(parseContext, - "[" + SimpleQueryStringBuilder.NAME + "] query does not support [" + currentFieldName - + "]"); + throw new QueryParsingException(parseContext, "[" + NAME + "] query does not support [" + currentFieldName + "]"); } } else if (token.isValue()) { if ("query".equals(currentFieldName)) { @@ -119,8 +125,6 @@ public class SimpleQueryStringParser extends BaseQueryParser { boost = parser.floatValue(); } else if ("analyzer".equals(currentFieldName)) { analyzerName = parser.text(); - } else if ("field".equals(currentFieldName)) { - field = parser.text(); } else if ("default_operator".equals(currentFieldName) || "defaultOperator".equals(currentFieldName)) { defaultOperator = Operator.fromString(parser.text()); } else if ("flags".equals(currentFieldName)) { @@ -158,11 +162,6 @@ public class SimpleQueryStringParser extends BaseQueryParser { throw new QueryParsingException(parseContext, "[" + SimpleQueryStringBuilder.NAME + "] query text missing"); } - // Support specifying only a field instead of a map - if (field == null) { - field = currentFieldName; - } - SimpleQueryStringBuilder qb = new SimpleQueryStringBuilder(queryBody); qb.boost(boost).fields(fieldsAndWeights).analyzer(analyzerName).queryName(queryName).minimumShouldMatch(minimumShouldMatch); qb.flags(flags).defaultOperator(defaultOperator).locale(locale).lowercaseExpandedTerms(lowercaseExpandedTerms); diff --git a/core/src/test/java/org/elasticsearch/ESExceptionTests.java b/core/src/test/java/org/elasticsearch/ESExceptionTests.java index 80d847ec80c..1439adabd33 100644 --- a/core/src/test/java/org/elasticsearch/ESExceptionTests.java +++ b/core/src/test/java/org/elasticsearch/ESExceptionTests.java @@ -53,10 +53,12 @@ import java.io.EOFException; import java.io.FileNotFoundException; import java.io.IOException; import java.nio.file.NoSuchFileException; +import java.util.Collections; import static org.hamcrest.Matchers.equalTo; public class ESExceptionTests extends ESTestCase { + private static final ToXContent.Params PARAMS = new ToXContent.MapParams(Collections.singletonMap(ElasticsearchException.REST_EXCEPTION_SKIP_STACK_TRACE, "true")); @Test public void testStatus() { @@ -145,7 +147,7 @@ public class ESExceptionTests extends ESTestCase { SearchPhaseExecutionException ex = new SearchPhaseExecutionException("search", "all shards failed", new ShardSearchFailure[]{failure, failure1}); XContentBuilder builder = XContentFactory.jsonBuilder(); builder.startObject(); - ex.toXContent(builder, ToXContent.EMPTY_PARAMS); + ex.toXContent(builder, PARAMS); builder.endObject(); String expected = "{\"type\":\"search_phase_execution_exception\",\"reason\":\"all shards failed\",\"phase\":\"search\",\"grouped\":true,\"failed_shards\":[{\"shard\":1,\"index\":\"foo\",\"node\":\"node_1\",\"reason\":{\"type\":\"test_query_parsing_exception\",\"reason\":\"foobar\",\"index\":\"foo\"}}]}"; assertEquals(expected, builder.string()); @@ -160,7 +162,7 @@ public class ESExceptionTests extends ESTestCase { SearchPhaseExecutionException ex = new SearchPhaseExecutionException("search", "all shards failed", new ShardSearchFailure[]{failure, failure1, failure2}); XContentBuilder builder = XContentFactory.jsonBuilder(); builder.startObject(); - ex.toXContent(builder, ToXContent.EMPTY_PARAMS); + ex.toXContent(builder, PARAMS); builder.endObject(); String expected = "{\"type\":\"search_phase_execution_exception\",\"reason\":\"all shards failed\",\"phase\":\"search\",\"grouped\":true,\"failed_shards\":[{\"shard\":1,\"index\":\"foo\",\"node\":\"node_1\",\"reason\":{\"type\":\"test_query_parsing_exception\",\"reason\":\"foobar\",\"index\":\"foo\"}},{\"shard\":1,\"index\":\"foo1\",\"node\":\"node_1\",\"reason\":{\"type\":\"test_query_parsing_exception\",\"reason\":\"foobar\",\"index\":\"foo1\"}}]}"; assertEquals(expected, builder.string()); @@ -185,7 +187,7 @@ public class ESExceptionTests extends ESTestCase { ElasticsearchException ex = new SearchParseException(new TestSearchContext(), "foo", new XContentLocation(1,0)); XContentBuilder builder = XContentFactory.jsonBuilder(); builder.startObject(); - ex.toXContent(builder, ToXContent.EMPTY_PARAMS); + ex.toXContent(builder, PARAMS); builder.endObject(); String expected = "{\"type\":\"search_parse_exception\",\"reason\":\"foo\",\"line\":1,\"col\":0}"; @@ -195,7 +197,7 @@ public class ESExceptionTests extends ESTestCase { ElasticsearchException ex = new ElasticsearchException("foo", new ElasticsearchException("bar", new IllegalArgumentException("index is closed", new RuntimeException("foobar")))); XContentBuilder builder = XContentFactory.jsonBuilder(); builder.startObject(); - ex.toXContent(builder, ToXContent.EMPTY_PARAMS); + ex.toXContent(builder, PARAMS); builder.endObject(); String expected = "{\"type\":\"exception\",\"reason\":\"foo\",\"caused_by\":{\"type\":\"exception\",\"reason\":\"bar\",\"caused_by\":{\"type\":\"illegal_argument_exception\",\"reason\":\"index is closed\",\"caused_by\":{\"type\":\"runtime_exception\",\"reason\":\"foobar\"}}}}"; @@ -210,7 +212,7 @@ public class ESExceptionTests extends ESTestCase { } XContentBuilder builder = XContentFactory.jsonBuilder(); builder.startObject(); - ElasticsearchException.toXContent(builder, ToXContent.EMPTY_PARAMS, ex); + ElasticsearchException.toXContent(builder, PARAMS, ex); builder.endObject(); String expected = "{\"type\":\"file_not_found_exception\",\"reason\":\"foo not found\"}"; @@ -221,7 +223,7 @@ public class ESExceptionTests extends ESTestCase { QueryParsingException ex = new TestQueryParsingException(new Index("foo"), 1, 2, "foobar", null); XContentBuilder builder = XContentFactory.jsonBuilder(); builder.startObject(); - ElasticsearchException.toXContent(builder, ToXContent.EMPTY_PARAMS, ex); + ElasticsearchException.toXContent(builder, PARAMS, ex); builder.endObject(); String expected = "{\"type\":\"test_query_parsing_exception\",\"reason\":\"foobar\",\"index\":\"foo\",\"line\":1,\"col\":2}"; assertEquals(expected, builder.string()); @@ -231,13 +233,13 @@ public class ESExceptionTests extends ESTestCase { ElasticsearchException ex = new RemoteTransportException("foobar", new FileNotFoundException("foo not found")); XContentBuilder builder = XContentFactory.jsonBuilder(); builder.startObject(); - ElasticsearchException.toXContent(builder, ToXContent.EMPTY_PARAMS, ex); + ElasticsearchException.toXContent(builder, PARAMS, ex); builder.endObject(); XContentBuilder otherBuilder = XContentFactory.jsonBuilder(); otherBuilder.startObject(); - ex.toXContent(otherBuilder, ToXContent.EMPTY_PARAMS); + ex.toXContent(otherBuilder, PARAMS); otherBuilder.endObject(); assertEquals(otherBuilder.string(), builder.string()); assertEquals("{\"type\":\"file_not_found_exception\",\"reason\":\"foo not found\"}", builder.string()); @@ -249,7 +251,7 @@ public class ESExceptionTests extends ESTestCase { ex.addHeader("test_multi", "some value", "another value"); XContentBuilder builder = XContentFactory.jsonBuilder(); builder.startObject(); - ElasticsearchException.toXContent(builder, ToXContent.EMPTY_PARAMS, ex); + ElasticsearchException.toXContent(builder, PARAMS, ex); builder.endObject(); assertThat(builder.string(), Matchers.anyOf( // iteration order depends on platform equalTo("{\"type\":\"test_query_parsing_exception\",\"reason\":\"foobar\",\"index\":\"foo\",\"line\":1,\"col\":2,\"header\":{\"test_multi\":[\"some value\",\"another value\"],\"test\":\"some value\"}}"), diff --git a/core/src/test/java/org/elasticsearch/ExceptionSerializationTests.java b/core/src/test/java/org/elasticsearch/ExceptionSerializationTests.java index e2b58bd19c9..9078cdc2ad6 100644 --- a/core/src/test/java/org/elasticsearch/ExceptionSerializationTests.java +++ b/core/src/test/java/org/elasticsearch/ExceptionSerializationTests.java @@ -93,6 +93,7 @@ import java.nio.file.FileVisitor; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.attribute.BasicFileAttributes; +import java.util.Collections; import java.util.HashSet; import java.util.Set; @@ -540,7 +541,7 @@ public class ExceptionSerializationTests extends ESTestCase { try { XContentBuilder builder = XContentFactory.jsonBuilder(); builder.startObject(); - x.toXContent(builder, ToXContent.EMPTY_PARAMS); + x.toXContent(builder, new ToXContent.MapParams(Collections.singletonMap(ElasticsearchException.REST_EXCEPTION_SKIP_STACK_TRACE, "true"))); builder.endObject(); return builder.string(); } catch (IOException e) { diff --git a/core/src/test/java/org/elasticsearch/action/search/MultiSearchRequestTests.java b/core/src/test/java/org/elasticsearch/action/search/MultiSearchRequestTests.java index 97aee6ea3d6..cad56790631 100644 --- a/core/src/test/java/org/elasticsearch/action/search/MultiSearchRequestTests.java +++ b/core/src/test/java/org/elasticsearch/action/search/MultiSearchRequestTests.java @@ -19,6 +19,7 @@ package org.elasticsearch.action.search; +import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.test.StreamsUtils; import org.elasticsearch.common.xcontent.ToXContent; @@ -28,6 +29,7 @@ import org.elasticsearch.test.ESTestCase; import org.junit.Test; import java.io.IOException; +import java.util.Collections; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.nullValue; @@ -123,7 +125,7 @@ public class MultiSearchRequestTests extends ESTestCase { public void testResponseErrorToXContent() throws IOException { MultiSearchResponse response = new MultiSearchResponse(new MultiSearchResponse.Item[]{new MultiSearchResponse.Item(null, new IllegalStateException("foobar")), new MultiSearchResponse.Item(null, new IllegalStateException("baaaaaazzzz"))}); XContentBuilder builder = XContentFactory.jsonBuilder(); - response.toXContent(builder, ToXContent.EMPTY_PARAMS); + response.toXContent(builder, new ToXContent.MapParams(Collections.singletonMap(ElasticsearchException.REST_EXCEPTION_SKIP_STACK_TRACE, "true"))); assertEquals("\"responses\"[{\"error\":{\"root_cause\":[{\"type\":\"illegal_state_exception\",\"reason\":\"foobar\"}],\"type\":\"illegal_state_exception\",\"reason\":\"foobar\"}},{\"error\":{\"root_cause\":[{\"type\":\"illegal_state_exception\",\"reason\":\"baaaaaazzzz\"}],\"type\":\"illegal_state_exception\",\"reason\":\"baaaaaazzzz\"}}]", builder.string()); } diff --git a/core/src/test/java/org/elasticsearch/index/query/SimpleIndexQueryParserTests.java b/core/src/test/java/org/elasticsearch/index/query/SimpleIndexQueryParserTests.java index bd040f039f5..5d21af2b50c 100644 --- a/core/src/test/java/org/elasticsearch/index/query/SimpleIndexQueryParserTests.java +++ b/core/src/test/java/org/elasticsearch/index/query/SimpleIndexQueryParserTests.java @@ -21,7 +21,6 @@ package org.elasticsearch.index.query; import com.google.common.collect.Lists; import com.google.common.collect.Sets; - import org.apache.lucene.analysis.core.WhitespaceAnalyzer; import org.apache.lucene.index.*; import org.apache.lucene.index.memory.MemoryIndex; @@ -74,10 +73,10 @@ import java.util.Arrays; import java.util.EnumSet; import java.util.List; -import static org.elasticsearch.test.StreamsUtils.copyToBytesFromClasspath; -import static org.elasticsearch.test.StreamsUtils.copyToStringFromClasspath; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.index.query.QueryBuilders.*; +import static org.elasticsearch.test.StreamsUtils.copyToBytesFromClasspath; +import static org.elasticsearch.test.StreamsUtils.copyToStringFromClasspath; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertBooleanSubQuery; import static org.hamcrest.Matchers.*; @@ -2284,14 +2283,6 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase { } } - @Test - public void testSimpleQueryString() throws Exception { - IndexQueryParserService queryParser = queryParser(); - String query = copyToStringFromClasspath("/org/elasticsearch/index/query/simple-query-string.json"); - Query parsedQuery = queryParser.parse(query).query(); - assertThat(parsedQuery, instanceOf(BooleanQuery.class)); - } - @Test public void testMatchWithFuzzyTranspositions() throws Exception { IndexQueryParserService queryParser = queryParser(); @@ -2374,7 +2365,7 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase { IndexQueryParserService queryParser = queryParser(); String query = jsonBuilder().startObject().startObject("function_score") .startArray("functions") - .startObject().field("weight", 2).field("boost_factor",2).endObject() + .startObject().field("weight", 2).field("boost_factor", 2).endObject() .endArray() .endObject().endObject().string(); try { diff --git a/core/src/test/java/org/elasticsearch/index/query/SimpleQueryStringBuilderTest.java b/core/src/test/java/org/elasticsearch/index/query/SimpleQueryStringBuilderTest.java index 7a17ec7afc0..36a24d72d7b 100644 --- a/core/src/test/java/org/elasticsearch/index/query/SimpleQueryStringBuilderTest.java +++ b/core/src/test/java/org/elasticsearch/index/query/SimpleQueryStringBuilderTest.java @@ -19,16 +19,20 @@ package org.elasticsearch.index.query; +import org.apache.lucene.index.Term; import org.apache.lucene.search.BooleanClause; import org.apache.lucene.search.BooleanQuery; import org.apache.lucene.search.Query; +import org.apache.lucene.search.TermQuery; +import org.elasticsearch.cluster.metadata.MetaData; +import org.elasticsearch.common.xcontent.XContentFactory; +import org.elasticsearch.common.xcontent.XContentParser; import org.junit.Test; import java.io.IOException; import java.util.*; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; +import static org.hamcrest.Matchers.*; public class SimpleQueryStringBuilderTest extends BaseQueryTestCase { @@ -86,6 +90,27 @@ public class SimpleQueryStringBuilderTest extends BaseQueryTestCase 1) { + assertThat(query, instanceOf(BooleanQuery.class)); + BooleanQuery booleanQuery = (BooleanQuery) query; + assertThat(booleanQuery.clauses().size(), equalTo(queryBuilder.fields().size())); + Iterator fields = queryBuilder.fields().keySet().iterator(); + for (BooleanClause booleanClause : booleanQuery) { + assertThat(booleanClause.getQuery(), instanceOf(TermQuery.class)); + TermQuery termQuery = (TermQuery) booleanClause.getQuery(); + assertThat(termQuery.getTerm(), equalTo(new Term(fields.next(), queryBuilder.text().toLowerCase(Locale.ROOT)))); + } + } else { + assertThat(query, instanceOf(TermQuery.class)); + String field; + if (queryBuilder.fields().size() == 0) { + field = MetaData.ALL; + } else { + field = queryBuilder.fields().keySet().iterator().next(); + } + TermQuery termQuery = (TermQuery) query; + assertThat(termQuery.getTerm(), equalTo(new Term(field, queryBuilder.text().toLowerCase(Locale.ROOT)))); + } } @Test @@ -214,7 +239,28 @@ public class SimpleQueryStringBuilderTest extends BaseQueryTestCase - @@ -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/pom.xml b/qa/pom.xml index 066f897bbe7..d2afea8421f 100644 --- a/qa/pom.xml +++ b/qa/pom.xml @@ -147,6 +147,7 @@ smoke-test-plugins smoke-test-shaded + smoke-test-multinode 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); + } +} +