From 548fd9494b46c81b0caf69c27e9b5d200bc8260a Mon Sep 17 00:00:00 2001 From: Luca Cavanna Date: Fri, 13 Mar 2020 15:37:29 +0100 Subject: [PATCH] Move async search yaml tests to x-pack yaml test folder (#53537) The yaml tests for async search currently sit in its qa folder. There is no reason though for them to live in a separate folder as they don't require particular setup. This commit moves them to the main folder together with the other x-pack yaml tests so that they will be run by the client test runners too. --- .../plugin/async-search/qa/rest/build.gradle | 30 ---------------- .../xpack/search/AsyncSearchRestIT.java | 35 ------------------- .../xpack/search/AsyncSearchSecurityIT.java | 3 +- .../xpack/search/AsyncSearchRestTestCase.java | 15 -------- .../test/async_search}/10_basic.yml | 0 5 files changed, 2 insertions(+), 81 deletions(-) delete mode 100644 x-pack/plugin/async-search/qa/rest/build.gradle delete mode 100644 x-pack/plugin/async-search/qa/rest/src/test/java/org/elasticsearch/xpack/search/AsyncSearchRestIT.java delete mode 100644 x-pack/plugin/async-search/qa/src/main/java/org/elasticsearch/xpack/search/AsyncSearchRestTestCase.java rename x-pack/plugin/{async-search/qa/rest/src/test/resources/rest-api-spec/test/search => src/test/resources/rest-api-spec/test/async_search}/10_basic.yml (100%) diff --git a/x-pack/plugin/async-search/qa/rest/build.gradle b/x-pack/plugin/async-search/qa/rest/build.gradle deleted file mode 100644 index fbe97dcb7aba5..0000000000000 --- a/x-pack/plugin/async-search/qa/rest/build.gradle +++ /dev/null @@ -1,30 +0,0 @@ -import org.elasticsearch.gradle.test.RestIntegTestTask - -apply plugin: 'elasticsearch.testclusters' -apply plugin: 'elasticsearch.standalone-test' - -restResources { - restApi { - includeXpack 'async_search' - } -} - -dependencies { - testCompile project(path: xpackModule('core'), configuration: 'testArtifacts') - testCompile project(path: xpackModule('async-search'), configuration: 'runtime') -} - -task restTest(type: RestIntegTestTask) { - mustRunAfter(precommit) -} - -testClusters.restTest { - testDistribution = 'DEFAULT' - setting 'xpack.ml.enabled', 'false' - setting 'xpack.monitoring.enabled', 'false' - setting 'xpack.security.enabled', 'true' - user username: 'async-search-user', password: 'async-search-password' -} - -check.dependsOn restTest -test.enabled = false diff --git a/x-pack/plugin/async-search/qa/rest/src/test/java/org/elasticsearch/xpack/search/AsyncSearchRestIT.java b/x-pack/plugin/async-search/qa/rest/src/test/java/org/elasticsearch/xpack/search/AsyncSearchRestIT.java deleted file mode 100644 index 89bef2430f557..0000000000000 --- a/x-pack/plugin/async-search/qa/rest/src/test/java/org/elasticsearch/xpack/search/AsyncSearchRestIT.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -package org.elasticsearch.xpack.search; - -import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; -import org.elasticsearch.common.settings.SecureString; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.util.concurrent.ThreadContext; -import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate; -import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase; - -import static org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken.basicAuthHeaderValue; - -public class AsyncSearchRestIT extends ESClientYamlSuiteTestCase { - - public AsyncSearchRestIT(final ClientYamlTestCandidate testCandidate) { - super(testCandidate); - } - - @ParametersFactory - public static Iterable parameters() throws Exception { - return ESClientYamlSuiteTestCase.createParameters(); - } - - @Override - protected Settings restClientSettings() { - final String userAuthHeaderValue = basicAuthHeaderValue("async-search-user", - new SecureString("async-search-password".toCharArray())); - return Settings.builder().put(ThreadContext.PREFIX + ".Authorization", userAuthHeaderValue).build(); - } -} diff --git a/x-pack/plugin/async-search/qa/security/src/test/java/org/elasticsearch/xpack/search/AsyncSearchSecurityIT.java b/x-pack/plugin/async-search/qa/security/src/test/java/org/elasticsearch/xpack/search/AsyncSearchSecurityIT.java index d1760acda2b8d..05e0132deb7d3 100644 --- a/x-pack/plugin/async-search/qa/security/src/test/java/org/elasticsearch/xpack/search/AsyncSearchSecurityIT.java +++ b/x-pack/plugin/async-search/qa/security/src/test/java/org/elasticsearch/xpack/search/AsyncSearchSecurityIT.java @@ -19,6 +19,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.common.xcontent.json.JsonXContent; +import org.elasticsearch.test.rest.ESRestTestCase; import org.junit.Before; import java.io.IOException; @@ -31,7 +32,7 @@ import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; -public class AsyncSearchSecurityIT extends AsyncSearchRestTestCase { +public class AsyncSearchSecurityIT extends ESRestTestCase { /** * All tests run as a superuser but use es-security-runas-user to become a less privileged user. */ diff --git a/x-pack/plugin/async-search/qa/src/main/java/org/elasticsearch/xpack/search/AsyncSearchRestTestCase.java b/x-pack/plugin/async-search/qa/src/main/java/org/elasticsearch/xpack/search/AsyncSearchRestTestCase.java deleted file mode 100644 index f176efdda4201..0000000000000 --- a/x-pack/plugin/async-search/qa/src/main/java/org/elasticsearch/xpack/search/AsyncSearchRestTestCase.java +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ -package org.elasticsearch.xpack.search; - -import org.elasticsearch.test.rest.ESRestTestCase; - -public class AsyncSearchRestTestCase extends ESRestTestCase { - @Override - protected boolean preserveClusterUponCompletion() { - return true; - } -} diff --git a/x-pack/plugin/async-search/qa/rest/src/test/resources/rest-api-spec/test/search/10_basic.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/async_search/10_basic.yml similarity index 100% rename from x-pack/plugin/async-search/qa/rest/src/test/resources/rest-api-spec/test/search/10_basic.yml rename to x-pack/plugin/src/test/resources/rest-api-spec/test/async_search/10_basic.yml