From 47db1d6c28dca533fb324bd90167c5c61541f756 Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Thu, 10 May 2018 08:02:23 -0400 Subject: [PATCH] Reindex: Fold "with all deps" project into reindex (#30154) This folds the `:qa:smoke-test-reindex-with-all-modules` project into `:modules:reindex` by declaring the reindex's integration testing cluster requires the `parent-join` and `lang-painless` plugins and then moving all of the integration tests that depended on parent-join and painless into reindex. It saves us one cluster start up during the build at the cost of a little of the reindex module's "purity". Since the reindex module *does* have unit tests that test scripting without painless I'm fairly ok with that. --- modules/reindex/build.gradle | 6 +++ .../test/reindex/35_search_failures.yml | 2 +- .../test/reindex/85_scripting.yml | 25 +++++++++++++ .../test/reindex/95_parent_join.yml | 0 .../update_by_query/35_search_failure.yml | 2 +- .../test/update_by_query/80_scripting.yml | 22 +++++++++++ .../build.gradle | 26 ------------- ...ndexWithPainlessClientYamlTestSuiteIT.java | 37 ------------------- .../rest-api-spec/test/reindex/20_broken.yml | 24 ------------ .../rest-api-spec/test/reindex/30_timeout.yml | 33 ----------------- .../test/update_by_query/20_broken.yml | 21 ----------- .../test/update_by_query/30_timeout.yml | 30 --------------- 12 files changed, 55 insertions(+), 173 deletions(-) rename qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/reindex/40_search_failures.yml => modules/reindex/src/test/resources/rest-api-spec/test/reindex/35_search_failures.yml (96%) rename qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/reindex/10_script.yml => modules/reindex/src/test/resources/rest-api-spec/test/reindex/85_scripting.yml (94%) rename qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/reindex/50_reindex_with_parent_join.yml => modules/reindex/src/test/resources/rest-api-spec/test/reindex/95_parent_join.yml (100%) rename qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/update_by_query/40_search_failure.yml => modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/35_search_failure.yml (95%) rename qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/update_by_query/10_script.yml => modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/80_scripting.yml (95%) delete mode 100644 qa/smoke-test-reindex-with-all-modules/build.gradle delete mode 100644 qa/smoke-test-reindex-with-all-modules/src/test/java/org/elasticsearch/smoketest/SmokeTestReindexWithPainlessClientYamlTestSuiteIT.java delete mode 100644 qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/reindex/20_broken.yml delete mode 100644 qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/reindex/30_timeout.yml delete mode 100644 qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/update_by_query/20_broken.yml delete mode 100644 qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/update_by_query/30_timeout.yml diff --git a/modules/reindex/build.gradle b/modules/reindex/build.gradle index a153cc555c81d..765d55dd095c7 100644 --- a/modules/reindex/build.gradle +++ b/modules/reindex/build.gradle @@ -30,11 +30,17 @@ esplugin { } integTestCluster { + // Modules who's integration is explicitly tested in integration tests + module project(':modules:parent-join') + module project(':modules:lang-painless') // Whitelist reindexing from the local node so we can test reindex-from-remote. setting 'reindex.remote.whitelist', '127.0.0.1:*' } run { + // Modules who's integration is explicitly tested in integration tests + module project(':modules:parent-join') + module project(':modules:lang-painless') // Whitelist reindexing from the local node so we can test reindex-from-remote. setting 'reindex.remote.whitelist', '127.0.0.1:*' } diff --git a/qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/reindex/40_search_failures.yml b/modules/reindex/src/test/resources/rest-api-spec/test/reindex/35_search_failures.yml similarity index 96% rename from qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/reindex/40_search_failures.yml rename to modules/reindex/src/test/resources/rest-api-spec/test/reindex/35_search_failures.yml index 9cf022f2de04a..605891d2b32d3 100644 --- a/qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/reindex/40_search_failures.yml +++ b/modules/reindex/src/test/resources/rest-api-spec/test/reindex/35_search_failures.yml @@ -1,5 +1,5 @@ --- -"Response format search failures": +"Response format for search failures": - do: index: index: source diff --git a/qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/reindex/10_script.yml b/modules/reindex/src/test/resources/rest-api-spec/test/reindex/85_scripting.yml similarity index 94% rename from qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/reindex/10_script.yml rename to modules/reindex/src/test/resources/rest-api-spec/test/reindex/85_scripting.yml index 8fda091d80da6..617a46dfa66b5 100644 --- a/qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/reindex/10_script.yml +++ b/modules/reindex/src/test/resources/rest-api-spec/test/reindex/85_scripting.yml @@ -433,3 +433,28 @@ - match: { docs.2._index: index2 } - match: { docs.2._type: type2 } - match: { docs.2._id: fr_789 } + +--- +"Totally broken scripts report the error properly": + - do: + index: + index: twitter + type: tweet + id: 1 + body: { "user": "kimchy" } + - do: + indices.refresh: {} + + - do: + catch: request + reindex: + refresh: true + body: + source: + index: twitter + dest: + index: new_twitter + script: + lang: painless + source: syntax errors are fun! + - match: {error.reason: 'compile error'} diff --git a/qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/reindex/50_reindex_with_parent_join.yml b/modules/reindex/src/test/resources/rest-api-spec/test/reindex/95_parent_join.yml similarity index 100% rename from qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/reindex/50_reindex_with_parent_join.yml rename to modules/reindex/src/test/resources/rest-api-spec/test/reindex/95_parent_join.yml diff --git a/qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/update_by_query/40_search_failure.yml b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/35_search_failure.yml similarity index 95% rename from qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/update_by_query/40_search_failure.yml rename to modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/35_search_failure.yml index 12801dd3e2ccc..8ace77eee59eb 100644 --- a/qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/update_by_query/40_search_failure.yml +++ b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/35_search_failure.yml @@ -1,5 +1,5 @@ --- -"Response format search failures": +"Response format for search failures": - do: index: index: source diff --git a/qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/update_by_query/10_script.yml b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/80_scripting.yml similarity index 95% rename from qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/update_by_query/10_script.yml rename to modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/80_scripting.yml index 6b2fb00dc160c..20a6a74abddba 100644 --- a/qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/update_by_query/10_script.yml +++ b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/80_scripting.yml @@ -421,3 +421,25 @@ term: level: 11 - match: { hits.total: 0 } + +--- +"Totally broken scripts report the error properly": + - do: + index: + index: twitter + type: tweet + id: 1 + body: { "user": "kimchy" } + - do: + indices.refresh: {} + + - do: + catch: request + update_by_query: + index: twitter + refresh: true + body: + script: + lang: painless + source: syntax errors are fun! + - match: {error.reason: 'compile error'} diff --git a/qa/smoke-test-reindex-with-all-modules/build.gradle b/qa/smoke-test-reindex-with-all-modules/build.gradle deleted file mode 100644 index 1d2ef8a325833..0000000000000 --- a/qa/smoke-test-reindex-with-all-modules/build.gradle +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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. - */ - -apply plugin: 'elasticsearch.standalone-rest-test' -apply plugin: 'elasticsearch.rest-test' - -integTestCluster { - // Whitelist reindexing from the local node so we can test it. - setting 'reindex.remote.whitelist', '127.0.0.1:*' -} diff --git a/qa/smoke-test-reindex-with-all-modules/src/test/java/org/elasticsearch/smoketest/SmokeTestReindexWithPainlessClientYamlTestSuiteIT.java b/qa/smoke-test-reindex-with-all-modules/src/test/java/org/elasticsearch/smoketest/SmokeTestReindexWithPainlessClientYamlTestSuiteIT.java deleted file mode 100644 index db1e62a6b15e6..0000000000000 --- a/qa/smoke-test-reindex-with-all-modules/src/test/java/org/elasticsearch/smoketest/SmokeTestReindexWithPainlessClientYamlTestSuiteIT.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.yaml.ClientYamlTestCandidate; -import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase; - -public class SmokeTestReindexWithPainlessClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase { - public SmokeTestReindexWithPainlessClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) { - super(testCandidate); - } - - @ParametersFactory - public static Iterable parameters() throws Exception { - return ESClientYamlSuiteTestCase.createParameters(); - } -} diff --git a/qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/reindex/20_broken.yml b/qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/reindex/20_broken.yml deleted file mode 100644 index fa2c0124ea2a0..0000000000000 --- a/qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/reindex/20_broken.yml +++ /dev/null @@ -1,24 +0,0 @@ ---- -"Totally broken scripts report the error properly": - - do: - index: - index: twitter - type: tweet - id: 1 - body: { "user": "kimchy" } - - do: - indices.refresh: {} - - - do: - catch: request - reindex: - refresh: true - body: - source: - index: twitter - dest: - index: new_twitter - script: - lang: painless - source: syntax errors are fun! - - match: {error.reason: 'compile error'} diff --git a/qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/reindex/30_timeout.yml b/qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/reindex/30_timeout.yml deleted file mode 100644 index df514c61ceb68..0000000000000 --- a/qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/reindex/30_timeout.yml +++ /dev/null @@ -1,33 +0,0 @@ ---- -"Timeout": - - skip: - version: "all" - reason: painless doesn't support thread.sleep so we need to come up with a better way - - do: - index: - index: twitter - type: tweet - id: 1 - body: { "user": "kimchy" } - - do: - indices.refresh: {} - - - do: - catch: request_timeout - reindex: - refresh: true - body: - source: - index: twitter - timeout: 10 - query: - script: - lang: painless - # Sleep 100x longer than the timeout. That should cause a timeout! - # Return true causes the document to try to be collected which is what actually triggers the timeout. - script: java.lang.Thread.sleep(1000); return true - dest: - index: new_twitter - - is_true: timed_out - - match: {created: 0} - - match: {noops: 0} diff --git a/qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/update_by_query/20_broken.yml b/qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/update_by_query/20_broken.yml deleted file mode 100644 index 8863db5d2aef7..0000000000000 --- a/qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/update_by_query/20_broken.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- -"Totally broken scripts report the error properly": - - do: - index: - index: twitter - type: tweet - id: 1 - body: { "user": "kimchy" } - - do: - indices.refresh: {} - - - do: - catch: request - update_by_query: - index: twitter - refresh: true - body: - script: - lang: painless - source: syntax errors are fun! - - match: {error.reason: 'compile error'} diff --git a/qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/update_by_query/30_timeout.yml b/qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/update_by_query/30_timeout.yml deleted file mode 100644 index ac1ed14a1f894..0000000000000 --- a/qa/smoke-test-reindex-with-all-modules/src/test/resources/rest-api-spec/test/update_by_query/30_timeout.yml +++ /dev/null @@ -1,30 +0,0 @@ ---- -"Timeout": - - skip: - version: "all" - reason: painless doesn't support thread.sleep so we need to come up with a better way - - do: - index: - index: twitter - type: tweet - id: 1 - body: { "user": "kimchy" } - - do: - indices.refresh: {} - - - do: - catch: request_timeout - update_by_query: - index: twitter - refresh: true - search_timeout: 10ms - body: - query: - script: - lang: painless - # Sleep 100x longer than the timeout. That should cause a timeout! - # Return true causes the document to try to be collected which is what actually triggers the timeout. - script: java.lang.Thread.sleep(1000); return true - - is_true: timed_out - - match: {updated: 0} - - match: {noops: 0}