From 92809d6fd2d2e47124736e56d670870551b13d4f Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Mon, 3 Aug 2020 14:41:19 -0500 Subject: [PATCH 01/25] async-search --- x-pack/plugin/async-search/qa/rest/build.gradle | 11 ++--------- .../java/org/elasticsearch/qa/AsyncSearchRestIT.java | 0 .../test/async-search/10_deprecation.yml | 0 .../xpack/search/AsyncSearchIntegTestCase.java | 0 .../xpack/search/BlockingQueryBuilder.java | 5 ++--- 5 files changed, 4 insertions(+), 12 deletions(-) rename x-pack/plugin/async-search/qa/rest/src/{test => yamlRestTest}/java/org/elasticsearch/qa/AsyncSearchRestIT.java (100%) rename x-pack/plugin/async-search/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/async-search/10_deprecation.yml (100%) rename x-pack/plugin/async-search/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/search/AsyncSearchIntegTestCase.java (100%) rename x-pack/plugin/async-search/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/search/BlockingQueryBuilder.java (96%) diff --git a/x-pack/plugin/async-search/qa/rest/build.gradle b/x-pack/plugin/async-search/qa/rest/build.gradle index 319901b34ec7b..5f3f810fa45bf 100644 --- a/x-pack/plugin/async-search/qa/rest/build.gradle +++ b/x-pack/plugin/async-search/qa/rest/build.gradle @@ -1,8 +1,5 @@ -import org.elasticsearch.gradle.info.BuildParams - -apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.esplugin' -apply plugin: 'elasticsearch.rest-resources' +apply plugin: 'elasticsearch.yaml-rest-test' esplugin { description 'Deprecated query plugin' @@ -16,13 +13,9 @@ restResources { } } -testClusters.integTest { +testClusters.all { testDistribution = 'DEFAULT' - // add the deprecated query plugin - plugin file(project(':x-pack:plugin:async-search:qa:rest').tasks.bundlePlugin.archiveFile) setting 'xpack.security.enabled', 'false' } test.enabled = false - -check.dependsOn integTest diff --git a/x-pack/plugin/async-search/qa/rest/src/test/java/org/elasticsearch/qa/AsyncSearchRestIT.java b/x-pack/plugin/async-search/qa/rest/src/yamlRestTest/java/org/elasticsearch/qa/AsyncSearchRestIT.java similarity index 100% rename from x-pack/plugin/async-search/qa/rest/src/test/java/org/elasticsearch/qa/AsyncSearchRestIT.java rename to x-pack/plugin/async-search/qa/rest/src/yamlRestTest/java/org/elasticsearch/qa/AsyncSearchRestIT.java diff --git a/x-pack/plugin/async-search/qa/rest/src/test/resources/rest-api-spec/test/async-search/10_deprecation.yml b/x-pack/plugin/async-search/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/async-search/10_deprecation.yml similarity index 100% rename from x-pack/plugin/async-search/qa/rest/src/test/resources/rest-api-spec/test/async-search/10_deprecation.yml rename to x-pack/plugin/async-search/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/async-search/10_deprecation.yml diff --git a/x-pack/plugin/async-search/src/test/java/org/elasticsearch/xpack/search/AsyncSearchIntegTestCase.java b/x-pack/plugin/async-search/src/internalClusterTest/java/org/elasticsearch/xpack/search/AsyncSearchIntegTestCase.java similarity index 100% rename from x-pack/plugin/async-search/src/test/java/org/elasticsearch/xpack/search/AsyncSearchIntegTestCase.java rename to x-pack/plugin/async-search/src/internalClusterTest/java/org/elasticsearch/xpack/search/AsyncSearchIntegTestCase.java diff --git a/x-pack/plugin/async-search/src/test/java/org/elasticsearch/xpack/search/BlockingQueryBuilder.java b/x-pack/plugin/async-search/src/internalClusterTest/java/org/elasticsearch/xpack/search/BlockingQueryBuilder.java similarity index 96% rename from x-pack/plugin/async-search/src/test/java/org/elasticsearch/xpack/search/BlockingQueryBuilder.java rename to x-pack/plugin/async-search/src/internalClusterTest/java/org/elasticsearch/xpack/search/BlockingQueryBuilder.java index f51298564b5d0..7acdb23fbaf2f 100644 --- a/x-pack/plugin/async-search/src/test/java/org/elasticsearch/xpack/search/BlockingQueryBuilder.java +++ b/x-pack/plugin/async-search/src/internalClusterTest/java/org/elasticsearch/xpack/search/BlockingQueryBuilder.java @@ -15,7 +15,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.query.AbstractQueryBuilder; import org.elasticsearch.index.query.QueryShardContext; -import org.elasticsearch.xpack.search.AsyncSearchIntegTestCase.SearchResponseIterator; import java.io.Closeable; import java.io.IOException; @@ -125,8 +124,8 @@ public String getWriteableName() { * A synchronization aid that is used by {@link BlockingQueryBuilder} to block shards executions until * the consumer calls {@link QueryLatch#countDownAndReset()}. * The static {@link QueryLatch} is shared in {@link AsyncSearchIntegTestCase#assertBlockingIterator} to provide - * a {@link SearchResponseIterator} that unblocks shards executions whenever {@link SearchResponseIterator#next()} - * is called. + * a {@link AsyncSearchIntegTestCase.SearchResponseIterator} that unblocks shards executions whenever + * {@link AsyncSearchIntegTestCase.SearchResponseIterator#next()} is called. */ static class QueryLatch implements Closeable { private final Set failedShards = new HashSet<>(); From 0dc6caa1fb47c542eab621499ebd9d0fd544437a Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Mon, 3 Aug 2020 15:00:32 -0500 Subject: [PATCH 02/25] address java rest tests --- .../gradle/test/rest/JavaRestTestPlugin.java | 2 ++ x-pack/plugin/async-search/qa/security/build.gradle | 12 +++++------- .../xpack/search/AsyncSearchSecurityIT.java | 0 3 files changed, 7 insertions(+), 7 deletions(-) rename x-pack/plugin/async-search/qa/security/src/{test => javaRestTest}/java/org/elasticsearch/xpack/search/AsyncSearchSecurityIT.java (100%) diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/test/rest/JavaRestTestPlugin.java b/buildSrc/src/main/java/org/elasticsearch/gradle/test/rest/JavaRestTestPlugin.java index 4738d3525cf81..911c186eb7d15 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/test/rest/JavaRestTestPlugin.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/test/rest/JavaRestTestPlugin.java @@ -21,6 +21,7 @@ import org.elasticsearch.gradle.ElasticsearchJavaPlugin; import org.elasticsearch.gradle.test.RestIntegTestTask; +import org.elasticsearch.gradle.test.RestTestBasePlugin; import org.elasticsearch.gradle.testclusters.TestClustersPlugin; import org.elasticsearch.gradle.util.GradleUtils; import org.gradle.api.Plugin; @@ -44,6 +45,7 @@ public class JavaRestTestPlugin implements Plugin { public void apply(Project project) { project.getPluginManager().apply(ElasticsearchJavaPlugin.class); + project.getPluginManager().apply(RestTestBasePlugin.class); project.getPluginManager().apply(TestClustersPlugin.class); // create source set diff --git a/x-pack/plugin/async-search/qa/security/build.gradle b/x-pack/plugin/async-search/qa/security/build.gradle index b46cd20397ac9..8e7923999df37 100644 --- a/x-pack/plugin/async-search/qa/security/build.gradle +++ b/x-pack/plugin/async-search/qa/security/build.gradle @@ -1,14 +1,12 @@ -apply plugin: 'elasticsearch.testclusters' -apply plugin: 'elasticsearch.standalone-rest-test' -apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.java-rest-test' dependencies { - testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts') - testImplementation project(xpackModule('async-search')) - testImplementation project(':x-pack:plugin:async-search:qa') + javaRestTestImplementation project(path: xpackModule('core'), configuration: 'testArtifacts') + javaRestTestImplementation project(xpackModule('async-search')) + javaRestTestImplementation project(':x-pack:plugin:async-search:qa') } -testClusters.integTest { +testClusters.all { testDistribution = 'DEFAULT' numberOfNodes = 2 setting 'xpack.license.self_generated.type', 'trial' 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/javaRestTest/java/org/elasticsearch/xpack/search/AsyncSearchSecurityIT.java similarity index 100% rename from x-pack/plugin/async-search/qa/security/src/test/java/org/elasticsearch/xpack/search/AsyncSearchSecurityIT.java rename to x-pack/plugin/async-search/qa/security/src/javaRestTest/java/org/elasticsearch/xpack/search/AsyncSearchSecurityIT.java From 2b6ff9f51e3623eb79ee53efa9fec8a9e900c1f6 Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Mon, 3 Aug 2020 15:25:13 -0500 Subject: [PATCH 03/25] autoscaling --- x-pack/plugin/autoscaling/qa/rest/build.gradle | 18 ++++-------------- .../xpack/autoscaling/AutoscalingRestIT.java | 2 +- .../autoscaling/delete_autoscaling_policy.yml | 0 .../autoscaling/get_autoscaling_decision.yml | 0 .../autoscaling/get_autoscaling_policy.yml | 0 .../autoscaling/put_autoscaling_policy.yml | 0 .../autoscaling/AutoscalingIntegTestCase.java | 0 7 files changed, 5 insertions(+), 15 deletions(-) rename x-pack/plugin/autoscaling/qa/rest/src/{test => yamlRestTest}/java/org/elasticsearch/xpack/autoscaling/AutoscalingRestIT.java (96%) rename x-pack/plugin/autoscaling/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/autoscaling/delete_autoscaling_policy.yml (100%) rename x-pack/plugin/autoscaling/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/autoscaling/get_autoscaling_decision.yml (100%) rename x-pack/plugin/autoscaling/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/autoscaling/get_autoscaling_policy.yml (100%) rename x-pack/plugin/autoscaling/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/autoscaling/put_autoscaling_policy.yml (100%) rename x-pack/plugin/autoscaling/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/autoscaling/AutoscalingIntegTestCase.java (100%) diff --git a/x-pack/plugin/autoscaling/qa/rest/build.gradle b/x-pack/plugin/autoscaling/qa/rest/build.gradle index 4d46ca4f4ea05..81d4e70c098ee 100644 --- a/x-pack/plugin/autoscaling/qa/rest/build.gradle +++ b/x-pack/plugin/autoscaling/qa/rest/build.gradle @@ -1,13 +1,10 @@ import org.elasticsearch.gradle.info.BuildParams -import org.elasticsearch.gradle.test.RestIntegTestTask -apply plugin: 'elasticsearch.testclusters' -apply plugin: 'elasticsearch.standalone-test' -apply plugin: 'elasticsearch.rest-resources' +apply plugin: 'elasticsearch.yaml-rest-test' dependencies { - testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts') - testImplementation project(xpackModule('autoscaling')) + yamlRestTestImplementation project(path: xpackModule('core'), configuration: 'testArtifacts') + yamlRestTestImplementation project(xpackModule('autoscaling')) } restResources { @@ -17,11 +14,7 @@ restResources { } } -task restTest(type: RestIntegTestTask) { - mustRunAfter(precommit) -} - -testClusters.restTest { +testClusters.all { testDistribution = 'DEFAULT' if (BuildParams.isSnapshotBuild() == false) { systemProperty 'es.autoscaling_feature_flag_registered', 'true' @@ -32,6 +25,3 @@ testClusters.restTest { user username: 'autoscaling-admin', password: 'autoscaling-admin-password', role: 'superuser' user username: 'autoscaling-user', password: 'autoscaling-user-password', role: 'autoscaling' } - -check.dependsOn restTest -test.enabled = false diff --git a/x-pack/plugin/autoscaling/qa/rest/src/test/java/org/elasticsearch/xpack/autoscaling/AutoscalingRestIT.java b/x-pack/plugin/autoscaling/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/autoscaling/AutoscalingRestIT.java similarity index 96% rename from x-pack/plugin/autoscaling/qa/rest/src/test/java/org/elasticsearch/xpack/autoscaling/AutoscalingRestIT.java rename to x-pack/plugin/autoscaling/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/autoscaling/AutoscalingRestIT.java index 51bee1a218b17..dc8e0995ca854 100644 --- a/x-pack/plugin/autoscaling/qa/rest/src/test/java/org/elasticsearch/xpack/autoscaling/AutoscalingRestIT.java +++ b/x-pack/plugin/autoscaling/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/autoscaling/AutoscalingRestIT.java @@ -23,7 +23,7 @@ public AutoscalingRestIT(final ClientYamlTestCandidate testCandidate) { @ParametersFactory public static Iterable parameters() throws Exception { - return ESClientYamlSuiteTestCase.createParameters(); + return createParameters(); } @Override diff --git a/x-pack/plugin/autoscaling/qa/rest/src/test/resources/rest-api-spec/test/autoscaling/delete_autoscaling_policy.yml b/x-pack/plugin/autoscaling/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/autoscaling/delete_autoscaling_policy.yml similarity index 100% rename from x-pack/plugin/autoscaling/qa/rest/src/test/resources/rest-api-spec/test/autoscaling/delete_autoscaling_policy.yml rename to x-pack/plugin/autoscaling/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/autoscaling/delete_autoscaling_policy.yml diff --git a/x-pack/plugin/autoscaling/qa/rest/src/test/resources/rest-api-spec/test/autoscaling/get_autoscaling_decision.yml b/x-pack/plugin/autoscaling/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/autoscaling/get_autoscaling_decision.yml similarity index 100% rename from x-pack/plugin/autoscaling/qa/rest/src/test/resources/rest-api-spec/test/autoscaling/get_autoscaling_decision.yml rename to x-pack/plugin/autoscaling/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/autoscaling/get_autoscaling_decision.yml diff --git a/x-pack/plugin/autoscaling/qa/rest/src/test/resources/rest-api-spec/test/autoscaling/get_autoscaling_policy.yml b/x-pack/plugin/autoscaling/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/autoscaling/get_autoscaling_policy.yml similarity index 100% rename from x-pack/plugin/autoscaling/qa/rest/src/test/resources/rest-api-spec/test/autoscaling/get_autoscaling_policy.yml rename to x-pack/plugin/autoscaling/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/autoscaling/get_autoscaling_policy.yml diff --git a/x-pack/plugin/autoscaling/qa/rest/src/test/resources/rest-api-spec/test/autoscaling/put_autoscaling_policy.yml b/x-pack/plugin/autoscaling/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/autoscaling/put_autoscaling_policy.yml similarity index 100% rename from x-pack/plugin/autoscaling/qa/rest/src/test/resources/rest-api-spec/test/autoscaling/put_autoscaling_policy.yml rename to x-pack/plugin/autoscaling/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/autoscaling/put_autoscaling_policy.yml diff --git a/x-pack/plugin/autoscaling/src/test/java/org/elasticsearch/xpack/autoscaling/AutoscalingIntegTestCase.java b/x-pack/plugin/autoscaling/src/internalClusterTest/java/org/elasticsearch/xpack/autoscaling/AutoscalingIntegTestCase.java similarity index 100% rename from x-pack/plugin/autoscaling/src/test/java/org/elasticsearch/xpack/autoscaling/AutoscalingIntegTestCase.java rename to x-pack/plugin/autoscaling/src/internalClusterTest/java/org/elasticsearch/xpack/autoscaling/AutoscalingIntegTestCase.java From 54446e22a76b5c08558debdaf6042f68d74bfd77 Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Mon, 3 Aug 2020 15:31:29 -0500 Subject: [PATCH 04/25] ccr:rest --- x-pack/plugin/ccr/qa/rest/build.gradle | 18 ++++-------------- .../org/elasticsearch/xpack/ccr/CcrRestIT.java | 6 +++--- .../rest-api-spec/test/ccr/auto_follow.yml | 0 .../test/ccr/follow_and_unfollow.yml | 0 .../rest-api-spec/test/ccr/follow_info.yml | 0 .../rest-api-spec/test/ccr/follow_stats.yml | 0 .../rest-api-spec/test/ccr/forget_follower.yml | 0 .../ccr/index_directly_into_follower_index.yml | 0 .../resources/rest-api-spec/test/ccr/stats.yml | 0 9 files changed, 7 insertions(+), 17 deletions(-) rename x-pack/plugin/ccr/qa/rest/src/{test => yamlRestTest}/java/org/elasticsearch/xpack/ccr/CcrRestIT.java (87%) rename x-pack/plugin/ccr/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/ccr/auto_follow.yml (100%) rename x-pack/plugin/ccr/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/ccr/follow_and_unfollow.yml (100%) rename x-pack/plugin/ccr/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/ccr/follow_info.yml (100%) rename x-pack/plugin/ccr/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/ccr/follow_stats.yml (100%) rename x-pack/plugin/ccr/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/ccr/forget_follower.yml (100%) rename x-pack/plugin/ccr/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/ccr/index_directly_into_follower_index.yml (100%) rename x-pack/plugin/ccr/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/ccr/stats.yml (100%) diff --git a/x-pack/plugin/ccr/qa/rest/build.gradle b/x-pack/plugin/ccr/qa/rest/build.gradle index 925fdb0972187..c4c22afefcca2 100644 --- a/x-pack/plugin/ccr/qa/rest/build.gradle +++ b/x-pack/plugin/ccr/qa/rest/build.gradle @@ -1,8 +1,4 @@ -import org.elasticsearch.gradle.test.RestIntegTestTask - -apply plugin: 'elasticsearch.testclusters' -apply plugin: 'elasticsearch.standalone-test' -apply plugin: 'elasticsearch.rest-resources' +apply plugin: 'elasticsearch.yaml-rest-test' restResources { restApi { @@ -12,15 +8,11 @@ restResources { } dependencies { - testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts') - testImplementation project(path: xpackModule('ccr')) -} - -task restTest(type: RestIntegTestTask) { - mustRunAfter(precommit) + yamlRestTestImplementation project(path: xpackModule('core'), configuration: 'testArtifacts') + yamlRestTestImplementation project(path: xpackModule('ccr')) } -testClusters.restTest { +testClusters.all { testDistribution = 'DEFAULT' // Disable assertions in FollowingEngineAssertions, otherwise an AssertionError is thrown before // indexing a document directly in a follower index. In a rest test we like to test the exception @@ -33,5 +25,3 @@ testClusters.restTest { user username: 'ccr-user', password: 'ccr-user-password', role: 'superuser' } -check.dependsOn restTest -test.enabled = false diff --git a/x-pack/plugin/ccr/qa/rest/src/test/java/org/elasticsearch/xpack/ccr/CcrRestIT.java b/x-pack/plugin/ccr/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/ccr/CcrRestIT.java similarity index 87% rename from x-pack/plugin/ccr/qa/rest/src/test/java/org/elasticsearch/xpack/ccr/CcrRestIT.java rename to x-pack/plugin/ccr/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/ccr/CcrRestIT.java index f12f687f401e8..81462d0d772a0 100644 --- a/x-pack/plugin/ccr/qa/rest/src/test/java/org/elasticsearch/xpack/ccr/CcrRestIT.java +++ b/x-pack/plugin/ccr/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/ccr/CcrRestIT.java @@ -27,7 +27,7 @@ public CcrRestIT(final ClientYamlTestCandidate testCandidate) { @ParametersFactory public static Iterable parameters() throws Exception { - return ESClientYamlSuiteTestCase.createParameters(); + return createParameters(); } @Override @@ -38,12 +38,12 @@ protected Settings restClientSettings() { @Before public void waitForRequirements() throws Exception { - ESRestTestCase.waitForActiveLicense(adminClient()); + waitForActiveLicense(adminClient()); } @After public void cleanup() throws Exception { - ESRestTestCase.waitForPendingTasks(adminClient(), taskName -> taskName.startsWith(ShardChangesAction.NAME)); + waitForPendingTasks(adminClient(), taskName -> taskName.startsWith(ShardChangesAction.NAME)); } } diff --git a/x-pack/plugin/ccr/qa/rest/src/test/resources/rest-api-spec/test/ccr/auto_follow.yml b/x-pack/plugin/ccr/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ccr/auto_follow.yml similarity index 100% rename from x-pack/plugin/ccr/qa/rest/src/test/resources/rest-api-spec/test/ccr/auto_follow.yml rename to x-pack/plugin/ccr/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ccr/auto_follow.yml diff --git a/x-pack/plugin/ccr/qa/rest/src/test/resources/rest-api-spec/test/ccr/follow_and_unfollow.yml b/x-pack/plugin/ccr/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ccr/follow_and_unfollow.yml similarity index 100% rename from x-pack/plugin/ccr/qa/rest/src/test/resources/rest-api-spec/test/ccr/follow_and_unfollow.yml rename to x-pack/plugin/ccr/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ccr/follow_and_unfollow.yml diff --git a/x-pack/plugin/ccr/qa/rest/src/test/resources/rest-api-spec/test/ccr/follow_info.yml b/x-pack/plugin/ccr/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ccr/follow_info.yml similarity index 100% rename from x-pack/plugin/ccr/qa/rest/src/test/resources/rest-api-spec/test/ccr/follow_info.yml rename to x-pack/plugin/ccr/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ccr/follow_info.yml diff --git a/x-pack/plugin/ccr/qa/rest/src/test/resources/rest-api-spec/test/ccr/follow_stats.yml b/x-pack/plugin/ccr/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ccr/follow_stats.yml similarity index 100% rename from x-pack/plugin/ccr/qa/rest/src/test/resources/rest-api-spec/test/ccr/follow_stats.yml rename to x-pack/plugin/ccr/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ccr/follow_stats.yml diff --git a/x-pack/plugin/ccr/qa/rest/src/test/resources/rest-api-spec/test/ccr/forget_follower.yml b/x-pack/plugin/ccr/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ccr/forget_follower.yml similarity index 100% rename from x-pack/plugin/ccr/qa/rest/src/test/resources/rest-api-spec/test/ccr/forget_follower.yml rename to x-pack/plugin/ccr/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ccr/forget_follower.yml diff --git a/x-pack/plugin/ccr/qa/rest/src/test/resources/rest-api-spec/test/ccr/index_directly_into_follower_index.yml b/x-pack/plugin/ccr/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ccr/index_directly_into_follower_index.yml similarity index 100% rename from x-pack/plugin/ccr/qa/rest/src/test/resources/rest-api-spec/test/ccr/index_directly_into_follower_index.yml rename to x-pack/plugin/ccr/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ccr/index_directly_into_follower_index.yml diff --git a/x-pack/plugin/ccr/qa/rest/src/test/resources/rest-api-spec/test/ccr/stats.yml b/x-pack/plugin/ccr/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ccr/stats.yml similarity index 100% rename from x-pack/plugin/ccr/qa/rest/src/test/resources/rest-api-spec/test/ccr/stats.yml rename to x-pack/plugin/ccr/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ccr/stats.yml From 537fe051e8986cd244308ac739b499e4d46aa3a0 Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Mon, 3 Aug 2020 16:11:58 -0500 Subject: [PATCH 05/25] enrich --- x-pack/plugin/data-streams/qa/build.gradle | 8 -------- .../plugin/data-streams/qa/multi-node/build.gradle | 10 ++++------ .../xpack/datastreams/DataStreamRestIT.java | 0 x-pack/plugin/data-streams/qa/rest/build.gradle | 9 +++------ .../xpack/datastreams/DataStreamsRestIT.java | 2 +- .../test/data-streams/100_delete_by_query.yml | 0 .../rest-api-spec/test/data-streams/10_basic.yml | 0 .../test/data-streams/110_update_by_query.yml | 0 .../test/data-streams/120_data_streams_stats.yml | 0 .../test/data-streams/20_unsupported_apis.yml | 0 .../data-streams/30_auto_create_data_stream.yml | 0 .../test/data-streams/40_supported_apis.yml | 0 .../data-streams/50_delete_backing_indices.yml | 0 .../test/data-streams/60_get_backing_indices.yml | 0 .../test/data-streams/70_rollover_data_streams.yml | 0 .../data-streams/80_resolve_index_data_streams.yml | 0 .../rest-api-spec/test/data-streams/90_reindex.yml | 0 x-pack/plugin/enrich/qa/common/build.gradle | 14 ++++++++++++++ .../test/enrich/CommonEnrichRestTestCase.java | 0 .../enrich/qa/rest-with-security/build.gradle | 12 +++++------- .../xpack/enrich/EnrichSecurityFailureIT.java | 0 .../xpack/enrich/EnrichSecurityIT.java | 0 x-pack/plugin/enrich/qa/rest/build.gradle | 12 +++++------- .../org/elasticsearch/xpack/enrich/EnrichIT.java | 0 .../elasticsearch/xpack/enrich/EnrichRestIT.java | 2 +- .../rest-api-spec/test/enrich/10_basic.yml | 0 26 files changed, 33 insertions(+), 36 deletions(-) rename x-pack/plugin/data-streams/qa/multi-node/src/{test => javaRestTest}/java/org/elasticsearch/xpack/datastreams/DataStreamRestIT.java (100%) rename x-pack/plugin/data-streams/qa/rest/src/{test => yamlRestTest}/java/org/elasticsearch/xpack/datastreams/DataStreamsRestIT.java (92%) rename x-pack/plugin/data-streams/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/data-streams/100_delete_by_query.yml (100%) rename x-pack/plugin/data-streams/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/data-streams/10_basic.yml (100%) rename x-pack/plugin/data-streams/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/data-streams/110_update_by_query.yml (100%) rename x-pack/plugin/data-streams/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/data-streams/120_data_streams_stats.yml (100%) rename x-pack/plugin/data-streams/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/data-streams/20_unsupported_apis.yml (100%) rename x-pack/plugin/data-streams/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/data-streams/30_auto_create_data_stream.yml (100%) rename x-pack/plugin/data-streams/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/data-streams/40_supported_apis.yml (100%) rename x-pack/plugin/data-streams/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/data-streams/50_delete_backing_indices.yml (100%) rename x-pack/plugin/data-streams/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/data-streams/60_get_backing_indices.yml (100%) rename x-pack/plugin/data-streams/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/data-streams/70_rollover_data_streams.yml (100%) rename x-pack/plugin/data-streams/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/data-streams/80_resolve_index_data_streams.yml (100%) rename x-pack/plugin/data-streams/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/data-streams/90_reindex.yml (100%) rename x-pack/plugin/enrich/qa/common/src/{main => test}/java/org/elasticsearch/test/enrich/CommonEnrichRestTestCase.java (100%) rename x-pack/plugin/enrich/qa/rest-with-security/src/{test => javaRestTest}/java/org/elasticsearch/xpack/enrich/EnrichSecurityFailureIT.java (100%) rename x-pack/plugin/enrich/qa/rest-with-security/src/{test => javaRestTest}/java/org/elasticsearch/xpack/enrich/EnrichSecurityIT.java (100%) rename x-pack/plugin/enrich/qa/rest/src/{test => javaRestTest}/java/org/elasticsearch/xpack/enrich/EnrichIT.java (100%) rename x-pack/plugin/enrich/qa/rest/src/{test => yamlRestTest}/java/org/elasticsearch/xpack/enrich/EnrichRestIT.java (92%) rename x-pack/plugin/enrich/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/enrich/10_basic.yml (100%) diff --git a/x-pack/plugin/data-streams/qa/build.gradle b/x-pack/plugin/data-streams/qa/build.gradle index 75d524cc11500..e69de29bb2d1d 100644 --- a/x-pack/plugin/data-streams/qa/build.gradle +++ b/x-pack/plugin/data-streams/qa/build.gradle @@ -1,8 +0,0 @@ -import org.elasticsearch.gradle.test.RestIntegTestTask - -apply plugin: 'elasticsearch.build' -test.enabled = false - -dependencies { - api project(':test:framework') -} diff --git a/x-pack/plugin/data-streams/qa/multi-node/build.gradle b/x-pack/plugin/data-streams/qa/multi-node/build.gradle index ba90325327827..0d9b0212c1b5d 100644 --- a/x-pack/plugin/data-streams/qa/multi-node/build.gradle +++ b/x-pack/plugin/data-streams/qa/multi-node/build.gradle @@ -1,21 +1,19 @@ import org.elasticsearch.gradle.info.BuildParams -apply plugin: 'elasticsearch.testclusters' -apply plugin: 'elasticsearch.standalone-rest-test' -apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.java-rest-test' dependencies { - testImplementation project(path: xpackProject('plugin').path, configuration: 'testArtifacts') + javaRestTestImplementation project(path: xpackProject('plugin').path, configuration: 'testArtifacts') } File repoDir = file("$buildDir/testclusters/repo") -integTest { +javaRestTest { /* To support taking index snapshots, we have to set path.repo setting */ systemProperty 'tests.path.repo', repoDir } -testClusters.integTest { +testClusters.javaRestTest { testDistribution = 'DEFAULT' if (BuildParams.isSnapshotBuild() == false) { systemProperty 'es.searchable_snapshots_feature_enabled', 'true' diff --git a/x-pack/plugin/data-streams/qa/multi-node/src/test/java/org/elasticsearch/xpack/datastreams/DataStreamRestIT.java b/x-pack/plugin/data-streams/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/datastreams/DataStreamRestIT.java similarity index 100% rename from x-pack/plugin/data-streams/qa/multi-node/src/test/java/org/elasticsearch/xpack/datastreams/DataStreamRestIT.java rename to x-pack/plugin/data-streams/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/datastreams/DataStreamRestIT.java diff --git a/x-pack/plugin/data-streams/qa/rest/build.gradle b/x-pack/plugin/data-streams/qa/rest/build.gradle index 0144dfcbc4a23..1ab053656c5f1 100644 --- a/x-pack/plugin/data-streams/qa/rest/build.gradle +++ b/x-pack/plugin/data-streams/qa/rest/build.gradle @@ -1,7 +1,4 @@ -apply plugin: 'elasticsearch.testclusters' -apply plugin: 'elasticsearch.standalone-rest-test' -apply plugin: 'elasticsearch.rest-test' -apply plugin: 'elasticsearch.rest-resources' +apply plugin: 'elasticsearch.yaml-rest-test' restResources { restApi { @@ -11,10 +8,10 @@ restResources { } dependencies { - testImplementation project(path: xpackModule('data-streams')) + yamlRestTestImplementation project(path: xpackModule('data-streams')) } -testClusters.integTest { +testClusters.all { testDistribution = 'DEFAULT' setting 'xpack.license.self_generated.type', 'basic' } diff --git a/x-pack/plugin/data-streams/qa/rest/src/test/java/org/elasticsearch/xpack/datastreams/DataStreamsRestIT.java b/x-pack/plugin/data-streams/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/datastreams/DataStreamsRestIT.java similarity index 92% rename from x-pack/plugin/data-streams/qa/rest/src/test/java/org/elasticsearch/xpack/datastreams/DataStreamsRestIT.java rename to x-pack/plugin/data-streams/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/datastreams/DataStreamsRestIT.java index 97703509df013..1d40326391ace 100644 --- a/x-pack/plugin/data-streams/qa/rest/src/test/java/org/elasticsearch/xpack/datastreams/DataStreamsRestIT.java +++ b/x-pack/plugin/data-streams/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/datastreams/DataStreamsRestIT.java @@ -18,7 +18,7 @@ public DataStreamsRestIT(final ClientYamlTestCandidate testCandidate) { @ParametersFactory public static Iterable parameters() throws Exception { - return ESClientYamlSuiteTestCase.createParameters(); + return createParameters(); } } diff --git a/x-pack/plugin/data-streams/qa/rest/src/test/resources/rest-api-spec/test/data-streams/100_delete_by_query.yml b/x-pack/plugin/data-streams/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/data-streams/100_delete_by_query.yml similarity index 100% rename from x-pack/plugin/data-streams/qa/rest/src/test/resources/rest-api-spec/test/data-streams/100_delete_by_query.yml rename to x-pack/plugin/data-streams/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/data-streams/100_delete_by_query.yml diff --git a/x-pack/plugin/data-streams/qa/rest/src/test/resources/rest-api-spec/test/data-streams/10_basic.yml b/x-pack/plugin/data-streams/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/data-streams/10_basic.yml similarity index 100% rename from x-pack/plugin/data-streams/qa/rest/src/test/resources/rest-api-spec/test/data-streams/10_basic.yml rename to x-pack/plugin/data-streams/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/data-streams/10_basic.yml diff --git a/x-pack/plugin/data-streams/qa/rest/src/test/resources/rest-api-spec/test/data-streams/110_update_by_query.yml b/x-pack/plugin/data-streams/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/data-streams/110_update_by_query.yml similarity index 100% rename from x-pack/plugin/data-streams/qa/rest/src/test/resources/rest-api-spec/test/data-streams/110_update_by_query.yml rename to x-pack/plugin/data-streams/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/data-streams/110_update_by_query.yml diff --git a/x-pack/plugin/data-streams/qa/rest/src/test/resources/rest-api-spec/test/data-streams/120_data_streams_stats.yml b/x-pack/plugin/data-streams/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/data-streams/120_data_streams_stats.yml similarity index 100% rename from x-pack/plugin/data-streams/qa/rest/src/test/resources/rest-api-spec/test/data-streams/120_data_streams_stats.yml rename to x-pack/plugin/data-streams/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/data-streams/120_data_streams_stats.yml diff --git a/x-pack/plugin/data-streams/qa/rest/src/test/resources/rest-api-spec/test/data-streams/20_unsupported_apis.yml b/x-pack/plugin/data-streams/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/data-streams/20_unsupported_apis.yml similarity index 100% rename from x-pack/plugin/data-streams/qa/rest/src/test/resources/rest-api-spec/test/data-streams/20_unsupported_apis.yml rename to x-pack/plugin/data-streams/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/data-streams/20_unsupported_apis.yml diff --git a/x-pack/plugin/data-streams/qa/rest/src/test/resources/rest-api-spec/test/data-streams/30_auto_create_data_stream.yml b/x-pack/plugin/data-streams/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/data-streams/30_auto_create_data_stream.yml similarity index 100% rename from x-pack/plugin/data-streams/qa/rest/src/test/resources/rest-api-spec/test/data-streams/30_auto_create_data_stream.yml rename to x-pack/plugin/data-streams/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/data-streams/30_auto_create_data_stream.yml diff --git a/x-pack/plugin/data-streams/qa/rest/src/test/resources/rest-api-spec/test/data-streams/40_supported_apis.yml b/x-pack/plugin/data-streams/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/data-streams/40_supported_apis.yml similarity index 100% rename from x-pack/plugin/data-streams/qa/rest/src/test/resources/rest-api-spec/test/data-streams/40_supported_apis.yml rename to x-pack/plugin/data-streams/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/data-streams/40_supported_apis.yml diff --git a/x-pack/plugin/data-streams/qa/rest/src/test/resources/rest-api-spec/test/data-streams/50_delete_backing_indices.yml b/x-pack/plugin/data-streams/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/data-streams/50_delete_backing_indices.yml similarity index 100% rename from x-pack/plugin/data-streams/qa/rest/src/test/resources/rest-api-spec/test/data-streams/50_delete_backing_indices.yml rename to x-pack/plugin/data-streams/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/data-streams/50_delete_backing_indices.yml diff --git a/x-pack/plugin/data-streams/qa/rest/src/test/resources/rest-api-spec/test/data-streams/60_get_backing_indices.yml b/x-pack/plugin/data-streams/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/data-streams/60_get_backing_indices.yml similarity index 100% rename from x-pack/plugin/data-streams/qa/rest/src/test/resources/rest-api-spec/test/data-streams/60_get_backing_indices.yml rename to x-pack/plugin/data-streams/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/data-streams/60_get_backing_indices.yml diff --git a/x-pack/plugin/data-streams/qa/rest/src/test/resources/rest-api-spec/test/data-streams/70_rollover_data_streams.yml b/x-pack/plugin/data-streams/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/data-streams/70_rollover_data_streams.yml similarity index 100% rename from x-pack/plugin/data-streams/qa/rest/src/test/resources/rest-api-spec/test/data-streams/70_rollover_data_streams.yml rename to x-pack/plugin/data-streams/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/data-streams/70_rollover_data_streams.yml diff --git a/x-pack/plugin/data-streams/qa/rest/src/test/resources/rest-api-spec/test/data-streams/80_resolve_index_data_streams.yml b/x-pack/plugin/data-streams/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/data-streams/80_resolve_index_data_streams.yml similarity index 100% rename from x-pack/plugin/data-streams/qa/rest/src/test/resources/rest-api-spec/test/data-streams/80_resolve_index_data_streams.yml rename to x-pack/plugin/data-streams/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/data-streams/80_resolve_index_data_streams.yml diff --git a/x-pack/plugin/data-streams/qa/rest/src/test/resources/rest-api-spec/test/data-streams/90_reindex.yml b/x-pack/plugin/data-streams/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/data-streams/90_reindex.yml similarity index 100% rename from x-pack/plugin/data-streams/qa/rest/src/test/resources/rest-api-spec/test/data-streams/90_reindex.yml rename to x-pack/plugin/data-streams/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/data-streams/90_reindex.yml diff --git a/x-pack/plugin/enrich/qa/common/build.gradle b/x-pack/plugin/enrich/qa/common/build.gradle index 53a1915bb2a07..caeb625926b8a 100644 --- a/x-pack/plugin/enrich/qa/common/build.gradle +++ b/x-pack/plugin/enrich/qa/common/build.gradle @@ -4,3 +4,17 @@ test.enabled = false dependencies { api project(':test:framework') } + +configurations { + testArtifacts.extendsFrom testRuntime + testArtifacts.extendsFrom testImplementation +} + +def testJar = tasks.register("testJar", Jar) { + appendix 'test' + from sourceSets.test.output +} + +artifacts { + testArtifacts testJar +} diff --git a/x-pack/plugin/enrich/qa/common/src/main/java/org/elasticsearch/test/enrich/CommonEnrichRestTestCase.java b/x-pack/plugin/enrich/qa/common/src/test/java/org/elasticsearch/test/enrich/CommonEnrichRestTestCase.java similarity index 100% rename from x-pack/plugin/enrich/qa/common/src/main/java/org/elasticsearch/test/enrich/CommonEnrichRestTestCase.java rename to x-pack/plugin/enrich/qa/common/src/test/java/org/elasticsearch/test/enrich/CommonEnrichRestTestCase.java diff --git a/x-pack/plugin/enrich/qa/rest-with-security/build.gradle b/x-pack/plugin/enrich/qa/rest-with-security/build.gradle index 901a4a885570f..39e9fba7aa8a4 100644 --- a/x-pack/plugin/enrich/qa/rest-with-security/build.gradle +++ b/x-pack/plugin/enrich/qa/rest-with-security/build.gradle @@ -1,14 +1,12 @@ -apply plugin: 'elasticsearch.testclusters' -apply plugin: 'elasticsearch.standalone-rest-test' -apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.java-rest-test' dependencies { - testImplementation project(path: xpackModule('enrich')) - testImplementation project(path: xpackModule('core')) - testImplementation project(path: xpackModule('enrich:qa:common')) + javaRestTestImplementation project(path: xpackModule('enrich')) + javaRestTestImplementation project(path: xpackModule('core')) + javaRestTestImplementation project(path: xpackModule('enrich:qa:common')) } -testClusters.integTest { +testClusters.all { testDistribution = 'DEFAULT' extraConfigFile 'roles.yml', file('roles.yml') user username: "test_admin", password: "x-pack-test-password", role: "superuser" diff --git a/x-pack/plugin/enrich/qa/rest-with-security/src/test/java/org/elasticsearch/xpack/enrich/EnrichSecurityFailureIT.java b/x-pack/plugin/enrich/qa/rest-with-security/src/javaRestTest/java/org/elasticsearch/xpack/enrich/EnrichSecurityFailureIT.java similarity index 100% rename from x-pack/plugin/enrich/qa/rest-with-security/src/test/java/org/elasticsearch/xpack/enrich/EnrichSecurityFailureIT.java rename to x-pack/plugin/enrich/qa/rest-with-security/src/javaRestTest/java/org/elasticsearch/xpack/enrich/EnrichSecurityFailureIT.java diff --git a/x-pack/plugin/enrich/qa/rest-with-security/src/test/java/org/elasticsearch/xpack/enrich/EnrichSecurityIT.java b/x-pack/plugin/enrich/qa/rest-with-security/src/javaRestTest/java/org/elasticsearch/xpack/enrich/EnrichSecurityIT.java similarity index 100% rename from x-pack/plugin/enrich/qa/rest-with-security/src/test/java/org/elasticsearch/xpack/enrich/EnrichSecurityIT.java rename to x-pack/plugin/enrich/qa/rest-with-security/src/javaRestTest/java/org/elasticsearch/xpack/enrich/EnrichSecurityIT.java diff --git a/x-pack/plugin/enrich/qa/rest/build.gradle b/x-pack/plugin/enrich/qa/rest/build.gradle index 2402a3d296a78..cfff1ed3eda0d 100644 --- a/x-pack/plugin/enrich/qa/rest/build.gradle +++ b/x-pack/plugin/enrich/qa/rest/build.gradle @@ -1,7 +1,5 @@ -apply plugin: 'elasticsearch.testclusters' -apply plugin: 'elasticsearch.standalone-rest-test' -apply plugin: 'elasticsearch.rest-test' -apply plugin: 'elasticsearch.rest-resources' +apply plugin: 'elasticsearch.java-rest-test' +apply plugin: 'elasticsearch.yaml-rest-test' restResources { restApi { @@ -11,11 +9,11 @@ restResources { } dependencies { - testImplementation project(path: xpackModule('enrich')) - testImplementation project(path: xpackModule('enrich:qa:common')) + javaRestTestImplementation project(path: xpackModule('enrich')) + javaRestTestImplementation project(path: xpackModule('enrich:qa:common'), configuration: 'testArtifacts') } -testClusters.integTest { +testClusters.all { testDistribution = 'DEFAULT' setting 'xpack.license.self_generated.type', 'basic' setting 'xpack.monitoring.collection.enabled', 'true' diff --git a/x-pack/plugin/enrich/qa/rest/src/test/java/org/elasticsearch/xpack/enrich/EnrichIT.java b/x-pack/plugin/enrich/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/enrich/EnrichIT.java similarity index 100% rename from x-pack/plugin/enrich/qa/rest/src/test/java/org/elasticsearch/xpack/enrich/EnrichIT.java rename to x-pack/plugin/enrich/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/enrich/EnrichIT.java diff --git a/x-pack/plugin/enrich/qa/rest/src/test/java/org/elasticsearch/xpack/enrich/EnrichRestIT.java b/x-pack/plugin/enrich/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/enrich/EnrichRestIT.java similarity index 92% rename from x-pack/plugin/enrich/qa/rest/src/test/java/org/elasticsearch/xpack/enrich/EnrichRestIT.java rename to x-pack/plugin/enrich/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/enrich/EnrichRestIT.java index 67d8c5af58626..a82bbf914fc2f 100644 --- a/x-pack/plugin/enrich/qa/rest/src/test/java/org/elasticsearch/xpack/enrich/EnrichRestIT.java +++ b/x-pack/plugin/enrich/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/enrich/EnrichRestIT.java @@ -18,7 +18,7 @@ public EnrichRestIT(final ClientYamlTestCandidate testCandidate) { @ParametersFactory public static Iterable parameters() throws Exception { - return ESClientYamlSuiteTestCase.createParameters(); + return createParameters(); } } diff --git a/x-pack/plugin/enrich/qa/rest/src/test/resources/rest-api-spec/test/enrich/10_basic.yml b/x-pack/plugin/enrich/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/enrich/10_basic.yml similarity index 100% rename from x-pack/plugin/enrich/qa/rest/src/test/resources/rest-api-spec/test/enrich/10_basic.yml rename to x-pack/plugin/enrich/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/enrich/10_basic.yml From 06dcaf33351da499b750e525a9445de86a91b1b4 Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Mon, 3 Aug 2020 16:29:55 -0500 Subject: [PATCH 06/25] eql --- x-pack/plugin/eql/qa/common/build.gradle | 14 ++++++++++++++ .../test/eql/CommonEqlActionTestCase.java | 0 .../test/eql/CommonEqlRestTestCase.java | 0 .../org/elasticsearch/test/eql/DataLoader.java | 0 .../java/org/elasticsearch/test/eql/EqlSpec.java | 0 .../org/elasticsearch/test/eql/EqlSpecLoader.java | 0 .../test/eql/stats/FeatureMetric.java | 0 .../test/eql/stats/RestEqlUsageTestCase.java | 0 .../resources/additional_test_queries.toml | 0 .../{main => test}/resources/mapping-default.json | 0 .../src/{main => test}/resources/test_data.json | 0 .../src/{main => test}/resources/test_queries.toml | 0 .../resources/test_queries_unsupported.toml | 0 x-pack/plugin/eql/qa/rest/build.gradle | 13 ++++--------- .../org/elasticsearch/xpack/eql/EqlActionIT.java | 0 .../java/org/elasticsearch/xpack/eql/EqlIT.java | 0 .../org/elasticsearch/xpack/eql/EqlStatsIT.java | 0 .../org/elasticsearch/xpack/eql/EqlRestIT.java | 2 +- .../resources/rest-api-spec/test/eql/10_basic.yml | 0 .../rest-api-spec/test/eql/20_data_streams.yml | 0 x-pack/plugin/eql/qa/security/build.gradle | 11 +++-------- .../xpack/eql/AsyncEqlSecurityIT.java | 0 22 files changed, 22 insertions(+), 18 deletions(-) rename x-pack/plugin/eql/qa/common/src/{main => test}/java/org/elasticsearch/test/eql/CommonEqlActionTestCase.java (100%) rename x-pack/plugin/eql/qa/common/src/{main => test}/java/org/elasticsearch/test/eql/CommonEqlRestTestCase.java (100%) rename x-pack/plugin/eql/qa/common/src/{main => test}/java/org/elasticsearch/test/eql/DataLoader.java (100%) rename x-pack/plugin/eql/qa/common/src/{main => test}/java/org/elasticsearch/test/eql/EqlSpec.java (100%) rename x-pack/plugin/eql/qa/common/src/{main => test}/java/org/elasticsearch/test/eql/EqlSpecLoader.java (100%) rename x-pack/plugin/eql/qa/common/src/{main => test}/java/org/elasticsearch/test/eql/stats/FeatureMetric.java (100%) rename x-pack/plugin/eql/qa/common/src/{main => test}/java/org/elasticsearch/test/eql/stats/RestEqlUsageTestCase.java (100%) rename x-pack/plugin/eql/qa/common/src/{main => test}/resources/additional_test_queries.toml (100%) rename x-pack/plugin/eql/qa/common/src/{main => test}/resources/mapping-default.json (100%) rename x-pack/plugin/eql/qa/common/src/{main => test}/resources/test_data.json (100%) rename x-pack/plugin/eql/qa/common/src/{main => test}/resources/test_queries.toml (100%) rename x-pack/plugin/eql/qa/common/src/{main => test}/resources/test_queries_unsupported.toml (100%) rename x-pack/plugin/eql/qa/rest/src/{test => javaRestTest}/java/org/elasticsearch/xpack/eql/EqlActionIT.java (100%) rename x-pack/plugin/eql/qa/rest/src/{test => javaRestTest}/java/org/elasticsearch/xpack/eql/EqlIT.java (100%) rename x-pack/plugin/eql/qa/rest/src/{test => javaRestTest}/java/org/elasticsearch/xpack/eql/EqlStatsIT.java (100%) rename x-pack/plugin/eql/qa/rest/src/{test => yamlRestTest}/java/org/elasticsearch/xpack/eql/EqlRestIT.java (94%) rename x-pack/plugin/eql/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/eql/10_basic.yml (100%) rename x-pack/plugin/eql/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/eql/20_data_streams.yml (100%) rename x-pack/plugin/eql/qa/security/src/{test => javaRestTest}/java/org/elasticsearch/xpack/eql/AsyncEqlSecurityIT.java (100%) diff --git a/x-pack/plugin/eql/qa/common/build.gradle b/x-pack/plugin/eql/qa/common/build.gradle index d41a69643bab7..1b45c82557a24 100644 --- a/x-pack/plugin/eql/qa/common/build.gradle +++ b/x-pack/plugin/eql/qa/common/build.gradle @@ -9,3 +9,17 @@ dependencies { // TOML parser for EqlActionIT tests api 'io.ous:jtoml:2.0.0' } + +configurations { + testArtifacts.extendsFrom testRuntime + testArtifacts.extendsFrom testImplementation +} + +def testJar = tasks.register("testJar", Jar) { + appendix 'test' + from sourceSets.test.output +} + +artifacts { + testArtifacts testJar +} diff --git a/x-pack/plugin/eql/qa/common/src/main/java/org/elasticsearch/test/eql/CommonEqlActionTestCase.java b/x-pack/plugin/eql/qa/common/src/test/java/org/elasticsearch/test/eql/CommonEqlActionTestCase.java similarity index 100% rename from x-pack/plugin/eql/qa/common/src/main/java/org/elasticsearch/test/eql/CommonEqlActionTestCase.java rename to x-pack/plugin/eql/qa/common/src/test/java/org/elasticsearch/test/eql/CommonEqlActionTestCase.java diff --git a/x-pack/plugin/eql/qa/common/src/main/java/org/elasticsearch/test/eql/CommonEqlRestTestCase.java b/x-pack/plugin/eql/qa/common/src/test/java/org/elasticsearch/test/eql/CommonEqlRestTestCase.java similarity index 100% rename from x-pack/plugin/eql/qa/common/src/main/java/org/elasticsearch/test/eql/CommonEqlRestTestCase.java rename to x-pack/plugin/eql/qa/common/src/test/java/org/elasticsearch/test/eql/CommonEqlRestTestCase.java diff --git a/x-pack/plugin/eql/qa/common/src/main/java/org/elasticsearch/test/eql/DataLoader.java b/x-pack/plugin/eql/qa/common/src/test/java/org/elasticsearch/test/eql/DataLoader.java similarity index 100% rename from x-pack/plugin/eql/qa/common/src/main/java/org/elasticsearch/test/eql/DataLoader.java rename to x-pack/plugin/eql/qa/common/src/test/java/org/elasticsearch/test/eql/DataLoader.java diff --git a/x-pack/plugin/eql/qa/common/src/main/java/org/elasticsearch/test/eql/EqlSpec.java b/x-pack/plugin/eql/qa/common/src/test/java/org/elasticsearch/test/eql/EqlSpec.java similarity index 100% rename from x-pack/plugin/eql/qa/common/src/main/java/org/elasticsearch/test/eql/EqlSpec.java rename to x-pack/plugin/eql/qa/common/src/test/java/org/elasticsearch/test/eql/EqlSpec.java diff --git a/x-pack/plugin/eql/qa/common/src/main/java/org/elasticsearch/test/eql/EqlSpecLoader.java b/x-pack/plugin/eql/qa/common/src/test/java/org/elasticsearch/test/eql/EqlSpecLoader.java similarity index 100% rename from x-pack/plugin/eql/qa/common/src/main/java/org/elasticsearch/test/eql/EqlSpecLoader.java rename to x-pack/plugin/eql/qa/common/src/test/java/org/elasticsearch/test/eql/EqlSpecLoader.java diff --git a/x-pack/plugin/eql/qa/common/src/main/java/org/elasticsearch/test/eql/stats/FeatureMetric.java b/x-pack/plugin/eql/qa/common/src/test/java/org/elasticsearch/test/eql/stats/FeatureMetric.java similarity index 100% rename from x-pack/plugin/eql/qa/common/src/main/java/org/elasticsearch/test/eql/stats/FeatureMetric.java rename to x-pack/plugin/eql/qa/common/src/test/java/org/elasticsearch/test/eql/stats/FeatureMetric.java diff --git a/x-pack/plugin/eql/qa/common/src/main/java/org/elasticsearch/test/eql/stats/RestEqlUsageTestCase.java b/x-pack/plugin/eql/qa/common/src/test/java/org/elasticsearch/test/eql/stats/RestEqlUsageTestCase.java similarity index 100% rename from x-pack/plugin/eql/qa/common/src/main/java/org/elasticsearch/test/eql/stats/RestEqlUsageTestCase.java rename to x-pack/plugin/eql/qa/common/src/test/java/org/elasticsearch/test/eql/stats/RestEqlUsageTestCase.java diff --git a/x-pack/plugin/eql/qa/common/src/main/resources/additional_test_queries.toml b/x-pack/plugin/eql/qa/common/src/test/resources/additional_test_queries.toml similarity index 100% rename from x-pack/plugin/eql/qa/common/src/main/resources/additional_test_queries.toml rename to x-pack/plugin/eql/qa/common/src/test/resources/additional_test_queries.toml diff --git a/x-pack/plugin/eql/qa/common/src/main/resources/mapping-default.json b/x-pack/plugin/eql/qa/common/src/test/resources/mapping-default.json similarity index 100% rename from x-pack/plugin/eql/qa/common/src/main/resources/mapping-default.json rename to x-pack/plugin/eql/qa/common/src/test/resources/mapping-default.json diff --git a/x-pack/plugin/eql/qa/common/src/main/resources/test_data.json b/x-pack/plugin/eql/qa/common/src/test/resources/test_data.json similarity index 100% rename from x-pack/plugin/eql/qa/common/src/main/resources/test_data.json rename to x-pack/plugin/eql/qa/common/src/test/resources/test_data.json diff --git a/x-pack/plugin/eql/qa/common/src/main/resources/test_queries.toml b/x-pack/plugin/eql/qa/common/src/test/resources/test_queries.toml similarity index 100% rename from x-pack/plugin/eql/qa/common/src/main/resources/test_queries.toml rename to x-pack/plugin/eql/qa/common/src/test/resources/test_queries.toml diff --git a/x-pack/plugin/eql/qa/common/src/main/resources/test_queries_unsupported.toml b/x-pack/plugin/eql/qa/common/src/test/resources/test_queries_unsupported.toml similarity index 100% rename from x-pack/plugin/eql/qa/common/src/main/resources/test_queries_unsupported.toml rename to x-pack/plugin/eql/qa/common/src/test/resources/test_queries_unsupported.toml diff --git a/x-pack/plugin/eql/qa/rest/build.gradle b/x-pack/plugin/eql/qa/rest/build.gradle index c89447234ebbb..9084e70ac5088 100644 --- a/x-pack/plugin/eql/qa/rest/build.gradle +++ b/x-pack/plugin/eql/qa/rest/build.gradle @@ -1,9 +1,5 @@ -import org.elasticsearch.gradle.info.BuildParams - -apply plugin: 'elasticsearch.testclusters' -apply plugin: 'elasticsearch.standalone-rest-test' -apply plugin: 'elasticsearch.rest-test' -apply plugin: 'elasticsearch.rest-resources' +apply plugin: 'elasticsearch.java-rest-test' +apply plugin: 'elasticsearch.yaml-rest-test' restResources { restApi { @@ -13,11 +9,10 @@ restResources { } dependencies { - testImplementation project(path: xpackModule('eql')) - testImplementation project(path: xpackModule('eql:qa:common')) + javaRestTestImplementation project(path: xpackModule('eql:qa:common'), configuration: 'testArtifacts') } -testClusters.integTest { +testClusters.all { testDistribution = 'DEFAULT' setting 'xpack.eql.enabled', 'true' setting 'xpack.license.self_generated.type', 'basic' diff --git a/x-pack/plugin/eql/qa/rest/src/test/java/org/elasticsearch/xpack/eql/EqlActionIT.java b/x-pack/plugin/eql/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/eql/EqlActionIT.java similarity index 100% rename from x-pack/plugin/eql/qa/rest/src/test/java/org/elasticsearch/xpack/eql/EqlActionIT.java rename to x-pack/plugin/eql/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/eql/EqlActionIT.java diff --git a/x-pack/plugin/eql/qa/rest/src/test/java/org/elasticsearch/xpack/eql/EqlIT.java b/x-pack/plugin/eql/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/eql/EqlIT.java similarity index 100% rename from x-pack/plugin/eql/qa/rest/src/test/java/org/elasticsearch/xpack/eql/EqlIT.java rename to x-pack/plugin/eql/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/eql/EqlIT.java diff --git a/x-pack/plugin/eql/qa/rest/src/test/java/org/elasticsearch/xpack/eql/EqlStatsIT.java b/x-pack/plugin/eql/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/eql/EqlStatsIT.java similarity index 100% rename from x-pack/plugin/eql/qa/rest/src/test/java/org/elasticsearch/xpack/eql/EqlStatsIT.java rename to x-pack/plugin/eql/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/eql/EqlStatsIT.java diff --git a/x-pack/plugin/eql/qa/rest/src/test/java/org/elasticsearch/xpack/eql/EqlRestIT.java b/x-pack/plugin/eql/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/eql/EqlRestIT.java similarity index 94% rename from x-pack/plugin/eql/qa/rest/src/test/java/org/elasticsearch/xpack/eql/EqlRestIT.java rename to x-pack/plugin/eql/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/eql/EqlRestIT.java index aa1df16c58553..b69d40b706a84 100644 --- a/x-pack/plugin/eql/qa/rest/src/test/java/org/elasticsearch/xpack/eql/EqlRestIT.java +++ b/x-pack/plugin/eql/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/eql/EqlRestIT.java @@ -25,7 +25,7 @@ public EqlRestIT(final ClientYamlTestCandidate testCandidate) { @ParametersFactory public static Iterable parameters() throws Exception { - return ESClientYamlSuiteTestCase.createParameters(); + return createParameters(); } } diff --git a/x-pack/plugin/eql/qa/rest/src/test/resources/rest-api-spec/test/eql/10_basic.yml b/x-pack/plugin/eql/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/eql/10_basic.yml similarity index 100% rename from x-pack/plugin/eql/qa/rest/src/test/resources/rest-api-spec/test/eql/10_basic.yml rename to x-pack/plugin/eql/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/eql/10_basic.yml diff --git a/x-pack/plugin/eql/qa/rest/src/test/resources/rest-api-spec/test/eql/20_data_streams.yml b/x-pack/plugin/eql/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/eql/20_data_streams.yml similarity index 100% rename from x-pack/plugin/eql/qa/rest/src/test/resources/rest-api-spec/test/eql/20_data_streams.yml rename to x-pack/plugin/eql/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/eql/20_data_streams.yml diff --git a/x-pack/plugin/eql/qa/security/build.gradle b/x-pack/plugin/eql/qa/security/build.gradle index b91721701df48..d77dfda8479b1 100644 --- a/x-pack/plugin/eql/qa/security/build.gradle +++ b/x-pack/plugin/eql/qa/security/build.gradle @@ -1,15 +1,10 @@ -import org.elasticsearch.gradle.info.BuildParams - -apply plugin: 'elasticsearch.testclusters' -apply plugin: 'elasticsearch.standalone-rest-test' -apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.java-rest-test' dependencies { - testImplementation project(path: xpackModule('eql')) - testImplementation project(path: xpackModule('eql:qa:common')) + javaRestTestImplementation project(path: xpackModule('eql:qa:common')) } -testClusters.integTest { +testClusters.all { testDistribution = 'DEFAULT' setting 'xpack.eql.enabled', 'true' setting 'xpack.license.self_generated.type', 'basic' diff --git a/x-pack/plugin/eql/qa/security/src/test/java/org/elasticsearch/xpack/eql/AsyncEqlSecurityIT.java b/x-pack/plugin/eql/qa/security/src/javaRestTest/java/org/elasticsearch/xpack/eql/AsyncEqlSecurityIT.java similarity index 100% rename from x-pack/plugin/eql/qa/security/src/test/java/org/elasticsearch/xpack/eql/AsyncEqlSecurityIT.java rename to x-pack/plugin/eql/qa/security/src/javaRestTest/java/org/elasticsearch/xpack/eql/AsyncEqlSecurityIT.java From 4b823b6bb59b69c98de22d3687de41bc5b9b7d5c Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Mon, 3 Aug 2020 16:32:56 -0500 Subject: [PATCH 07/25] enrich fixes --- x-pack/plugin/enrich/qa/rest-with-security/build.gradle | 3 +-- x-pack/plugin/enrich/qa/rest/build.gradle | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/x-pack/plugin/enrich/qa/rest-with-security/build.gradle b/x-pack/plugin/enrich/qa/rest-with-security/build.gradle index 39e9fba7aa8a4..656bb20bccd16 100644 --- a/x-pack/plugin/enrich/qa/rest-with-security/build.gradle +++ b/x-pack/plugin/enrich/qa/rest-with-security/build.gradle @@ -1,9 +1,8 @@ apply plugin: 'elasticsearch.java-rest-test' dependencies { - javaRestTestImplementation project(path: xpackModule('enrich')) javaRestTestImplementation project(path: xpackModule('core')) - javaRestTestImplementation project(path: xpackModule('enrich:qa:common')) + javaRestTestImplementation project(path: xpackModule('enrich:qa:common'), configuration: 'testArtifacts') } testClusters.all { diff --git a/x-pack/plugin/enrich/qa/rest/build.gradle b/x-pack/plugin/enrich/qa/rest/build.gradle index cfff1ed3eda0d..7faadb01f5e3f 100644 --- a/x-pack/plugin/enrich/qa/rest/build.gradle +++ b/x-pack/plugin/enrich/qa/rest/build.gradle @@ -9,7 +9,6 @@ restResources { } dependencies { - javaRestTestImplementation project(path: xpackModule('enrich')) javaRestTestImplementation project(path: xpackModule('enrich:qa:common'), configuration: 'testArtifacts') } From 7f1dff166d2ed4f19b081747cdc1265c657263f2 Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Mon, 3 Aug 2020 16:36:08 -0500 Subject: [PATCH 08/25] data stream fixes --- x-pack/plugin/data-streams/qa/multi-node/build.gradle | 4 ---- x-pack/plugin/data-streams/qa/rest/build.gradle | 4 ---- 2 files changed, 8 deletions(-) diff --git a/x-pack/plugin/data-streams/qa/multi-node/build.gradle b/x-pack/plugin/data-streams/qa/multi-node/build.gradle index 0d9b0212c1b5d..d8ca1d93e881f 100644 --- a/x-pack/plugin/data-streams/qa/multi-node/build.gradle +++ b/x-pack/plugin/data-streams/qa/multi-node/build.gradle @@ -2,10 +2,6 @@ import org.elasticsearch.gradle.info.BuildParams apply plugin: 'elasticsearch.java-rest-test' -dependencies { - javaRestTestImplementation project(path: xpackProject('plugin').path, configuration: 'testArtifacts') -} - File repoDir = file("$buildDir/testclusters/repo") javaRestTest { diff --git a/x-pack/plugin/data-streams/qa/rest/build.gradle b/x-pack/plugin/data-streams/qa/rest/build.gradle index 1ab053656c5f1..0bcae361c2ffc 100644 --- a/x-pack/plugin/data-streams/qa/rest/build.gradle +++ b/x-pack/plugin/data-streams/qa/rest/build.gradle @@ -7,10 +7,6 @@ restResources { } } -dependencies { - yamlRestTestImplementation project(path: xpackModule('data-streams')) -} - testClusters.all { testDistribution = 'DEFAULT' setting 'xpack.license.self_generated.type', 'basic' From 9e8b72ece46d46a508d11e3e5eaf533955474f02 Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Mon, 3 Aug 2020 16:40:06 -0500 Subject: [PATCH 09/25] ccr:rest fixes --- x-pack/plugin/ccr/qa/rest/build.gradle | 1 - .../java/org/elasticsearch/xpack/ccr/CcrRestIT.java | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/x-pack/plugin/ccr/qa/rest/build.gradle b/x-pack/plugin/ccr/qa/rest/build.gradle index c4c22afefcca2..ee65d86b50112 100644 --- a/x-pack/plugin/ccr/qa/rest/build.gradle +++ b/x-pack/plugin/ccr/qa/rest/build.gradle @@ -9,7 +9,6 @@ restResources { dependencies { yamlRestTestImplementation project(path: xpackModule('core'), configuration: 'testArtifacts') - yamlRestTestImplementation project(path: xpackModule('ccr')) } testClusters.all { diff --git a/x-pack/plugin/ccr/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/ccr/CcrRestIT.java b/x-pack/plugin/ccr/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/ccr/CcrRestIT.java index 81462d0d772a0..7e2e7cf9d7fde 100644 --- a/x-pack/plugin/ccr/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/ccr/CcrRestIT.java +++ b/x-pack/plugin/ccr/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/ccr/CcrRestIT.java @@ -10,10 +10,8 @@ import org.elasticsearch.common.settings.SecureString; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.concurrent.ThreadContext; -import org.elasticsearch.test.rest.ESRestTestCase; import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate; import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase; -import org.elasticsearch.xpack.ccr.action.ShardChangesAction; import org.junit.After; import org.junit.Before; @@ -43,7 +41,7 @@ public void waitForRequirements() throws Exception { @After public void cleanup() throws Exception { - waitForPendingTasks(adminClient(), taskName -> taskName.startsWith(ShardChangesAction.NAME)); + waitForPendingTasks(adminClient(), taskName -> taskName.startsWith("indices:data/read/xpack/ccr/shard_changes")); } } From 3ff33167102cea4df3c570b74ede65358c751122 Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Mon, 3 Aug 2020 16:41:43 -0500 Subject: [PATCH 10/25] autoscale fix --- x-pack/plugin/autoscaling/qa/rest/build.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/x-pack/plugin/autoscaling/qa/rest/build.gradle b/x-pack/plugin/autoscaling/qa/rest/build.gradle index 81d4e70c098ee..bdfa4886ab961 100644 --- a/x-pack/plugin/autoscaling/qa/rest/build.gradle +++ b/x-pack/plugin/autoscaling/qa/rest/build.gradle @@ -4,7 +4,6 @@ apply plugin: 'elasticsearch.yaml-rest-test' dependencies { yamlRestTestImplementation project(path: xpackModule('core'), configuration: 'testArtifacts') - yamlRestTestImplementation project(xpackModule('autoscaling')) } restResources { From 13c817667db32a203ed66541e68158ce15f1742a Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Mon, 3 Aug 2020 16:46:10 -0500 Subject: [PATCH 11/25] frozen-indices --- x-pack/plugin/frozen-indices/build.gradle | 1 + .../org/elasticsearch/index/engine/FrozenIndexRecoveryTests.java | 0 .../java/org/elasticsearch/index/engine/FrozenIndexTests.java | 0 3 files changed, 1 insertion(+) rename x-pack/plugin/frozen-indices/src/{test => internalClusterTest}/java/org/elasticsearch/index/engine/FrozenIndexRecoveryTests.java (100%) rename x-pack/plugin/frozen-indices/src/{test => internalClusterTest}/java/org/elasticsearch/index/engine/FrozenIndexTests.java (100%) diff --git a/x-pack/plugin/frozen-indices/build.gradle b/x-pack/plugin/frozen-indices/build.gradle index cf4a331589231..7e8108b6616f5 100644 --- a/x-pack/plugin/frozen-indices/build.gradle +++ b/x-pack/plugin/frozen-indices/build.gradle @@ -1,4 +1,5 @@ apply plugin: 'elasticsearch.esplugin' +apply plugin: 'elasticsearch.internal-cluster-test' esplugin { name 'frozen-indices' description 'A plugin for the frozen indices functionality' diff --git a/x-pack/plugin/frozen-indices/src/test/java/org/elasticsearch/index/engine/FrozenIndexRecoveryTests.java b/x-pack/plugin/frozen-indices/src/internalClusterTest/java/org/elasticsearch/index/engine/FrozenIndexRecoveryTests.java similarity index 100% rename from x-pack/plugin/frozen-indices/src/test/java/org/elasticsearch/index/engine/FrozenIndexRecoveryTests.java rename to x-pack/plugin/frozen-indices/src/internalClusterTest/java/org/elasticsearch/index/engine/FrozenIndexRecoveryTests.java diff --git a/x-pack/plugin/frozen-indices/src/test/java/org/elasticsearch/index/engine/FrozenIndexTests.java b/x-pack/plugin/frozen-indices/src/internalClusterTest/java/org/elasticsearch/index/engine/FrozenIndexTests.java similarity index 100% rename from x-pack/plugin/frozen-indices/src/test/java/org/elasticsearch/index/engine/FrozenIndexTests.java rename to x-pack/plugin/frozen-indices/src/internalClusterTest/java/org/elasticsearch/index/engine/FrozenIndexTests.java From 27f34cef2e82a679e017852812ef77c4b91a0a5d Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Mon, 3 Aug 2020 16:55:25 -0500 Subject: [PATCH 12/25] graph --- x-pack/plugin/graph/build.gradle | 1 + x-pack/plugin/graph/qa/with-security/build.gradle | 9 +++------ .../org/elasticsearch/smoketest/GraphWithSecurityIT.java | 6 +++--- .../smoketest/GraphWithSecurityInsufficientRoleIT.java | 0 .../org/elasticsearch/xpack/graph/test/GraphTests.java | 0 5 files changed, 7 insertions(+), 9 deletions(-) rename x-pack/plugin/graph/qa/with-security/src/{test => yamlRestTest}/java/org/elasticsearch/smoketest/GraphWithSecurityIT.java (96%) rename x-pack/plugin/graph/qa/with-security/src/{test => yamlRestTest}/java/org/elasticsearch/smoketest/GraphWithSecurityInsufficientRoleIT.java (100%) rename x-pack/plugin/graph/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/graph/test/GraphTests.java (100%) diff --git a/x-pack/plugin/graph/build.gradle b/x-pack/plugin/graph/build.gradle index 791db9d639dc6..336d6e8104984 100644 --- a/x-pack/plugin/graph/build.gradle +++ b/x-pack/plugin/graph/build.gradle @@ -1,4 +1,5 @@ apply plugin: 'elasticsearch.esplugin' +apply plugin: 'elasticsearch.internal-cluster-test' esplugin { name 'x-pack-graph' description 'Elasticsearch Expanded Pack Plugin - Graph' diff --git a/x-pack/plugin/graph/qa/with-security/build.gradle b/x-pack/plugin/graph/qa/with-security/build.gradle index c6853d02b4c78..92ad8521b4d2e 100644 --- a/x-pack/plugin/graph/qa/with-security/build.gradle +++ b/x-pack/plugin/graph/qa/with-security/build.gradle @@ -1,10 +1,7 @@ -apply plugin: 'elasticsearch.testclusters' -apply plugin: 'elasticsearch.standalone-rest-test' -apply plugin: 'elasticsearch.rest-test' -apply plugin: 'elasticsearch.rest-resources' +apply plugin: 'elasticsearch.yaml-rest-test' dependencies { - testImplementation project(":x-pack:plugin:core") + yamlRestTestImplementation project(":x-pack:plugin:core") } // bring in graph rest test suite @@ -18,7 +15,7 @@ restResources { } } -testClusters.integTest { +testClusters.all { testDistribution = 'DEFAULT' setting 'xpack.security.enabled', 'true' setting 'xpack.license.self_generated.type', 'trial' diff --git a/x-pack/plugin/graph/qa/with-security/src/test/java/org/elasticsearch/smoketest/GraphWithSecurityIT.java b/x-pack/plugin/graph/qa/with-security/src/yamlRestTest/java/org/elasticsearch/smoketest/GraphWithSecurityIT.java similarity index 96% rename from x-pack/plugin/graph/qa/with-security/src/test/java/org/elasticsearch/smoketest/GraphWithSecurityIT.java rename to x-pack/plugin/graph/qa/with-security/src/yamlRestTest/java/org/elasticsearch/smoketest/GraphWithSecurityIT.java index 5650f407dd310..ce9157000bc12 100644 --- a/x-pack/plugin/graph/qa/with-security/src/test/java/org/elasticsearch/smoketest/GraphWithSecurityIT.java +++ b/x-pack/plugin/graph/qa/with-security/src/yamlRestTest/java/org/elasticsearch/smoketest/GraphWithSecurityIT.java @@ -28,12 +28,12 @@ public GraphWithSecurityIT(@Name("yaml") ClientYamlTestCandidate testCandidate) @ParametersFactory public static Iterable parameters() throws Exception { - return ESClientYamlSuiteTestCase.createParameters(); + return createParameters(); } - + protected String[] getCredentials() { return new String[]{"graph_explorer", "x-pack-test-password"}; - } + } @Override diff --git a/x-pack/plugin/graph/qa/with-security/src/test/java/org/elasticsearch/smoketest/GraphWithSecurityInsufficientRoleIT.java b/x-pack/plugin/graph/qa/with-security/src/yamlRestTest/java/org/elasticsearch/smoketest/GraphWithSecurityInsufficientRoleIT.java similarity index 100% rename from x-pack/plugin/graph/qa/with-security/src/test/java/org/elasticsearch/smoketest/GraphWithSecurityInsufficientRoleIT.java rename to x-pack/plugin/graph/qa/with-security/src/yamlRestTest/java/org/elasticsearch/smoketest/GraphWithSecurityInsufficientRoleIT.java diff --git a/x-pack/plugin/graph/src/test/java/org/elasticsearch/xpack/graph/test/GraphTests.java b/x-pack/plugin/graph/src/internalClusterTest/java/org/elasticsearch/xpack/graph/test/GraphTests.java similarity index 100% rename from x-pack/plugin/graph/src/test/java/org/elasticsearch/xpack/graph/test/GraphTests.java rename to x-pack/plugin/graph/src/internalClusterTest/java/org/elasticsearch/xpack/graph/test/GraphTests.java From d5509df96acb5e7f7dfbd02f497b792398f13c56 Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Wed, 5 Aug 2020 10:14:19 -0500 Subject: [PATCH 13/25] fix autoscaling testing conventions --- x-pack/plugin/autoscaling/build.gradle | 6 ------ 1 file changed, 6 deletions(-) diff --git a/x-pack/plugin/autoscaling/build.gradle b/x-pack/plugin/autoscaling/build.gradle index f27275b42d2f2..588225fe31ed7 100644 --- a/x-pack/plugin/autoscaling/build.gradle +++ b/x-pack/plugin/autoscaling/build.gradle @@ -33,9 +33,3 @@ gradle.projectsEvaluated { .findAll { it.path.startsWith(project.path + ":qa") } .each { check.dependsOn it.check } } - -testingConventions.naming { - IT { - baseClass "org.elasticsearch.xpack.autoscaling.AutoscalingIntegTestCase" - } -} From 0caf4b3c29514e40e1cc82628e460dd83f4b6f16 Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Wed, 5 Aug 2020 11:54:36 -0500 Subject: [PATCH 14/25] identity-provider --- x-pack/plugin/identity-provider/build.gradle | 2 + .../qa/idp-rest-tests/build.gradle | 23 +++--- .../idp/IdentityProviderAuthenticationIT.java | 0 .../xpack/idp/IdpRestTestCase.java | 0 .../idp/ManageServiceProviderRestIT.java | 0 .../idp/WildcardServiceProviderRestIT.java | 0 .../resources/idp-metadata.xml | 0 .../resources/idp-sign.crt | 0 .../resources/idp-sign.key | 0 .../resources/roles.yml | 0 .../resources/wildcard_services.json | 0 .../idp/action/SamlIdentityProviderTests.java | 0 .../sp/SamlServiceProviderIndexTests.java | 57 +------------ .../test/IdentityProviderIntegTestCase.java | 0 .../PutSamlServiceProviderRequestTests.java | 12 +-- ...portPutSamlServiceProviderActionTests.java | 10 +-- .../sp/SamlServiceProviderResolverTests.java | 8 +- .../saml/sp/SamlServiceProviderTestUtils.java | 79 +++++++++++++++++++ 18 files changed, 108 insertions(+), 83 deletions(-) rename x-pack/plugin/identity-provider/qa/idp-rest-tests/src/{test => javaRestTest}/java/org/elasticsearch/xpack/idp/IdentityProviderAuthenticationIT.java (100%) rename x-pack/plugin/identity-provider/qa/idp-rest-tests/src/{test => javaRestTest}/java/org/elasticsearch/xpack/idp/IdpRestTestCase.java (100%) rename x-pack/plugin/identity-provider/qa/idp-rest-tests/src/{test => javaRestTest}/java/org/elasticsearch/xpack/idp/ManageServiceProviderRestIT.java (100%) rename x-pack/plugin/identity-provider/qa/idp-rest-tests/src/{test => javaRestTest}/java/org/elasticsearch/xpack/idp/WildcardServiceProviderRestIT.java (100%) rename x-pack/plugin/identity-provider/qa/idp-rest-tests/src/{test => javaRestTest}/resources/idp-metadata.xml (100%) rename x-pack/plugin/identity-provider/qa/idp-rest-tests/src/{test => javaRestTest}/resources/idp-sign.crt (100%) rename x-pack/plugin/identity-provider/qa/idp-rest-tests/src/{test => javaRestTest}/resources/idp-sign.key (100%) rename x-pack/plugin/identity-provider/qa/idp-rest-tests/src/{test => javaRestTest}/resources/roles.yml (100%) rename x-pack/plugin/identity-provider/qa/idp-rest-tests/src/{test => javaRestTest}/resources/wildcard_services.json (100%) rename x-pack/plugin/identity-provider/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/idp/action/SamlIdentityProviderTests.java (100%) rename x-pack/plugin/identity-provider/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/idp/saml/sp/SamlServiceProviderIndexTests.java (83%) rename x-pack/plugin/identity-provider/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/idp/saml/test/IdentityProviderIntegTestCase.java (100%) create mode 100644 x-pack/plugin/identity-provider/src/test/java/org/elasticsearch/xpack/idp/saml/sp/SamlServiceProviderTestUtils.java diff --git a/x-pack/plugin/identity-provider/build.gradle b/x-pack/plugin/identity-provider/build.gradle index a7348f0bb2390..b2b772ede7453 100644 --- a/x-pack/plugin/identity-provider/build.gradle +++ b/x-pack/plugin/identity-provider/build.gradle @@ -1,6 +1,7 @@ import org.elasticsearch.gradle.info.BuildParams apply plugin: 'elasticsearch.esplugin' apply plugin: 'elasticsearch.publish' +apply plugin: 'elasticsearch.internal-cluster-test' esplugin { name 'x-pack-identity-provider' description 'Elasticsearch Expanded Pack Plugin - Identity Provider' @@ -54,6 +55,7 @@ dependencies { compileJava.options.compilerArgs << "-Xlint:-rawtypes,-unchecked" compileTestJava.options.compilerArgs << "-Xlint:-rawtypes,-unchecked" + tasks.named("dependencyLicenses").configure { mapping from: /java-support|opensaml-.*/, to: 'shibboleth' mapping from: /http.*/, to: 'httpclient' diff --git a/x-pack/plugin/identity-provider/qa/idp-rest-tests/build.gradle b/x-pack/plugin/identity-provider/qa/idp-rest-tests/build.gradle index 70d1a8b3aeea5..ab1d3c497174f 100644 --- a/x-pack/plugin/identity-provider/qa/idp-rest-tests/build.gradle +++ b/x-pack/plugin/identity-provider/qa/idp-rest-tests/build.gradle @@ -1,14 +1,13 @@ -apply plugin: 'elasticsearch.testclusters' -apply plugin: 'elasticsearch.standalone-rest-test' -apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.java-rest-test' dependencies { - testImplementation project(path: xpackModule('core'), configuration: 'default') - testImplementation project(path: xpackModule('identity-provider'), configuration: 'default') - testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts') + javaRestTestImplementation project(path: xpackModule('core'), configuration: 'testArtifacts') + //TODO: update javaRestTests to not rely on any code that it is testing + javaRestTestImplementation project(path: xpackModule('identity-provider'), configuration: 'default') + javaRestTestImplementation project(path: xpackModule('core'), configuration: 'default') } -testClusters.integTest { +testClusters.all { testDistribution = 'DEFAULT' setting 'xpack.license.self_generated.type', 'trial' @@ -35,12 +34,12 @@ testClusters.integTest { setting 'xpack.security.authc.realms.saml.cloud-saml.attributes.name', 'https://idp.test.es.elasticsearch.org/attribute/name' setting 'logger.org.elasticsearch.xpack.security.authc.saml', 'TRACE' setting 'logger.org.elasticsearch.xpack.idp', 'TRACE' - extraConfigFile 'roles.yml', file('src/test/resources/roles.yml') - extraConfigFile 'idp-sign.crt', file('src/test/resources/idp-sign.crt') - extraConfigFile 'idp-sign.key', file('src/test/resources/idp-sign.key') - extraConfigFile 'wildcard_services.json', file('src/test/resources/wildcard_services.json') + extraConfigFile 'roles.yml', file('src/javaRestTest/resources/roles.yml') + extraConfigFile 'idp-sign.crt', file('src/javaRestTest/resources/idp-sign.crt') + extraConfigFile 'idp-sign.key', file('src/javaRestTest/resources/idp-sign.key') + extraConfigFile 'wildcard_services.json', file('src/javaRestTest/resources/wildcard_services.json') // The SAML SP is preconfigured with the metadata of the IDP - extraConfigFile 'idp-metadata.xml', file('src/test/resources/idp-metadata.xml') + extraConfigFile 'idp-metadata.xml', file('src/javaRestTest/resources/idp-metadata.xml') user username: "admin_user", password: "admin-password" user username: "idp_admin", password: "idp-password", role: "idp_admin" diff --git a/x-pack/plugin/identity-provider/qa/idp-rest-tests/src/test/java/org/elasticsearch/xpack/idp/IdentityProviderAuthenticationIT.java b/x-pack/plugin/identity-provider/qa/idp-rest-tests/src/javaRestTest/java/org/elasticsearch/xpack/idp/IdentityProviderAuthenticationIT.java similarity index 100% rename from x-pack/plugin/identity-provider/qa/idp-rest-tests/src/test/java/org/elasticsearch/xpack/idp/IdentityProviderAuthenticationIT.java rename to x-pack/plugin/identity-provider/qa/idp-rest-tests/src/javaRestTest/java/org/elasticsearch/xpack/idp/IdentityProviderAuthenticationIT.java diff --git a/x-pack/plugin/identity-provider/qa/idp-rest-tests/src/test/java/org/elasticsearch/xpack/idp/IdpRestTestCase.java b/x-pack/plugin/identity-provider/qa/idp-rest-tests/src/javaRestTest/java/org/elasticsearch/xpack/idp/IdpRestTestCase.java similarity index 100% rename from x-pack/plugin/identity-provider/qa/idp-rest-tests/src/test/java/org/elasticsearch/xpack/idp/IdpRestTestCase.java rename to x-pack/plugin/identity-provider/qa/idp-rest-tests/src/javaRestTest/java/org/elasticsearch/xpack/idp/IdpRestTestCase.java diff --git a/x-pack/plugin/identity-provider/qa/idp-rest-tests/src/test/java/org/elasticsearch/xpack/idp/ManageServiceProviderRestIT.java b/x-pack/plugin/identity-provider/qa/idp-rest-tests/src/javaRestTest/java/org/elasticsearch/xpack/idp/ManageServiceProviderRestIT.java similarity index 100% rename from x-pack/plugin/identity-provider/qa/idp-rest-tests/src/test/java/org/elasticsearch/xpack/idp/ManageServiceProviderRestIT.java rename to x-pack/plugin/identity-provider/qa/idp-rest-tests/src/javaRestTest/java/org/elasticsearch/xpack/idp/ManageServiceProviderRestIT.java diff --git a/x-pack/plugin/identity-provider/qa/idp-rest-tests/src/test/java/org/elasticsearch/xpack/idp/WildcardServiceProviderRestIT.java b/x-pack/plugin/identity-provider/qa/idp-rest-tests/src/javaRestTest/java/org/elasticsearch/xpack/idp/WildcardServiceProviderRestIT.java similarity index 100% rename from x-pack/plugin/identity-provider/qa/idp-rest-tests/src/test/java/org/elasticsearch/xpack/idp/WildcardServiceProviderRestIT.java rename to x-pack/plugin/identity-provider/qa/idp-rest-tests/src/javaRestTest/java/org/elasticsearch/xpack/idp/WildcardServiceProviderRestIT.java diff --git a/x-pack/plugin/identity-provider/qa/idp-rest-tests/src/test/resources/idp-metadata.xml b/x-pack/plugin/identity-provider/qa/idp-rest-tests/src/javaRestTest/resources/idp-metadata.xml similarity index 100% rename from x-pack/plugin/identity-provider/qa/idp-rest-tests/src/test/resources/idp-metadata.xml rename to x-pack/plugin/identity-provider/qa/idp-rest-tests/src/javaRestTest/resources/idp-metadata.xml diff --git a/x-pack/plugin/identity-provider/qa/idp-rest-tests/src/test/resources/idp-sign.crt b/x-pack/plugin/identity-provider/qa/idp-rest-tests/src/javaRestTest/resources/idp-sign.crt similarity index 100% rename from x-pack/plugin/identity-provider/qa/idp-rest-tests/src/test/resources/idp-sign.crt rename to x-pack/plugin/identity-provider/qa/idp-rest-tests/src/javaRestTest/resources/idp-sign.crt diff --git a/x-pack/plugin/identity-provider/qa/idp-rest-tests/src/test/resources/idp-sign.key b/x-pack/plugin/identity-provider/qa/idp-rest-tests/src/javaRestTest/resources/idp-sign.key similarity index 100% rename from x-pack/plugin/identity-provider/qa/idp-rest-tests/src/test/resources/idp-sign.key rename to x-pack/plugin/identity-provider/qa/idp-rest-tests/src/javaRestTest/resources/idp-sign.key diff --git a/x-pack/plugin/identity-provider/qa/idp-rest-tests/src/test/resources/roles.yml b/x-pack/plugin/identity-provider/qa/idp-rest-tests/src/javaRestTest/resources/roles.yml similarity index 100% rename from x-pack/plugin/identity-provider/qa/idp-rest-tests/src/test/resources/roles.yml rename to x-pack/plugin/identity-provider/qa/idp-rest-tests/src/javaRestTest/resources/roles.yml diff --git a/x-pack/plugin/identity-provider/qa/idp-rest-tests/src/test/resources/wildcard_services.json b/x-pack/plugin/identity-provider/qa/idp-rest-tests/src/javaRestTest/resources/wildcard_services.json similarity index 100% rename from x-pack/plugin/identity-provider/qa/idp-rest-tests/src/test/resources/wildcard_services.json rename to x-pack/plugin/identity-provider/qa/idp-rest-tests/src/javaRestTest/resources/wildcard_services.json diff --git a/x-pack/plugin/identity-provider/src/test/java/org/elasticsearch/xpack/idp/action/SamlIdentityProviderTests.java b/x-pack/plugin/identity-provider/src/internalClusterTest/java/org/elasticsearch/xpack/idp/action/SamlIdentityProviderTests.java similarity index 100% rename from x-pack/plugin/identity-provider/src/test/java/org/elasticsearch/xpack/idp/action/SamlIdentityProviderTests.java rename to x-pack/plugin/identity-provider/src/internalClusterTest/java/org/elasticsearch/xpack/idp/action/SamlIdentityProviderTests.java diff --git a/x-pack/plugin/identity-provider/src/test/java/org/elasticsearch/xpack/idp/saml/sp/SamlServiceProviderIndexTests.java b/x-pack/plugin/identity-provider/src/internalClusterTest/java/org/elasticsearch/xpack/idp/saml/sp/SamlServiceProviderIndexTests.java similarity index 83% rename from x-pack/plugin/identity-provider/src/test/java/org/elasticsearch/xpack/idp/saml/sp/SamlServiceProviderIndexTests.java rename to x-pack/plugin/identity-provider/src/internalClusterTest/java/org/elasticsearch/xpack/idp/saml/sp/SamlServiceProviderIndexTests.java index e4dcdbb195fd4..3d33b83320778 100644 --- a/x-pack/plugin/identity-provider/src/test/java/org/elasticsearch/xpack/idp/saml/sp/SamlServiceProviderIndexTests.java +++ b/x-pack/plugin/identity-provider/src/internalClusterTest/java/org/elasticsearch/xpack/idp/saml/sp/SamlServiceProviderIndexTests.java @@ -19,7 +19,6 @@ import org.elasticsearch.cluster.metadata.IndexTemplateMetadata; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.test.ESSingleNodeTestCase; import org.elasticsearch.xpack.core.LocalStateCompositeXPackPlugin; @@ -30,7 +29,6 @@ import java.util.ArrayList; import java.util.Collection; -import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Set; @@ -39,6 +37,7 @@ import static org.elasticsearch.xpack.idp.saml.idp.SamlIdentityProviderBuilder.IDP_ENTITY_ID; import static org.elasticsearch.xpack.idp.saml.idp.SamlIdentityProviderBuilder.IDP_SSO_REDIRECT_ENDPOINT; +import static org.elasticsearch.xpack.idp.saml.sp.SamlServiceProviderTestUtils.randomDocument; import static org.hamcrest.Matchers.arrayContainingInAnyOrder; import static org.hamcrest.Matchers.emptyIterable; import static org.hamcrest.Matchers.equalTo; @@ -46,7 +45,6 @@ import static org.hamcrest.Matchers.iterableWithSize; import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.nullValue; -import static org.opensaml.saml.saml2.core.NameIDType.TRANSIENT; public class SamlServiceProviderIndexTests extends ESSingleNodeTestCase { @@ -242,59 +240,6 @@ private void refresh() { future.actionGet(); } - public static SamlServiceProviderDocument randomDocument() { - return randomDocument(randomIntBetween(1, 999_999)); - } - - public static SamlServiceProviderDocument randomDocument(int index) { - final SamlServiceProviderDocument document = new SamlServiceProviderDocument(); - document.setName(randomAlphaOfLengthBetween(5, 12)); - document.setEntityId(randomUri() + index); - document.setAcs(randomUri("https") + index + "/saml/acs"); - - document.setEnabled(randomBoolean()); - document.setCreatedMillis(System.currentTimeMillis() - TimeValue.timeValueDays(randomIntBetween(2, 90)).millis()); - document.setLastModifiedMillis(System.currentTimeMillis() - TimeValue.timeValueHours(randomIntBetween(1, 36)).millis()); - - if (randomBoolean()) { - document.setNameIdFormat(TRANSIENT); - } - if (randomBoolean()) { - document.setAuthenticationExpiryMillis(TimeValue.timeValueMinutes(randomIntBetween(1, 15)).millis()); - } - - document.privileges.setResource("app:" + randomAlphaOfLengthBetween(3, 6) + ":" + Math.abs(randomLong())); - final int roleCount = randomIntBetween(0, 4); - final Set roles = new HashSet<>(); - for (int i = 0; i < roleCount; i++) { - roles.add(randomAlphaOfLengthBetween(3, 6) + ":(" + randomAlphaOfLengthBetween(3, 6) + ")"); - } - document.privileges.setRolePatterns(roles); - - document.attributeNames.setPrincipal(randomUri()); - if (randomBoolean()) { - document.attributeNames.setName(randomUri()); - } - if (randomBoolean()) { - document.attributeNames.setEmail(randomUri()); - } - if (roles.isEmpty() == false) { - document.attributeNames.setRoles(randomUri()); - } - - assertThat(document.validate(), nullValue()); - return document; - } - - private static String randomUri() { - return randomUri(randomFrom("urn", "http", "https")); - } - - private static String randomUri(String scheme) { - return scheme + "://" + randomAlphaOfLengthBetween(2, 6) + "." - + randomAlphaOfLengthBetween(4, 8) + "." + randomAlphaOfLengthBetween(2, 4) + "/"; - } - private static ActionListener assertListenerIsOnlyCalledOnce(ActionListener delegate) { final AtomicInteger callCount = new AtomicInteger(0); return ActionListener.runBefore(delegate, () -> { diff --git a/x-pack/plugin/identity-provider/src/test/java/org/elasticsearch/xpack/idp/saml/test/IdentityProviderIntegTestCase.java b/x-pack/plugin/identity-provider/src/internalClusterTest/java/org/elasticsearch/xpack/idp/saml/test/IdentityProviderIntegTestCase.java similarity index 100% rename from x-pack/plugin/identity-provider/src/test/java/org/elasticsearch/xpack/idp/saml/test/IdentityProviderIntegTestCase.java rename to x-pack/plugin/identity-provider/src/internalClusterTest/java/org/elasticsearch/xpack/idp/saml/test/IdentityProviderIntegTestCase.java diff --git a/x-pack/plugin/identity-provider/src/test/java/org/elasticsearch/xpack/idp/action/PutSamlServiceProviderRequestTests.java b/x-pack/plugin/identity-provider/src/test/java/org/elasticsearch/xpack/idp/action/PutSamlServiceProviderRequestTests.java index 1da597c6100dc..bae2a8393c9be 100644 --- a/x-pack/plugin/identity-provider/src/test/java/org/elasticsearch/xpack/idp/action/PutSamlServiceProviderRequestTests.java +++ b/x-pack/plugin/identity-provider/src/test/java/org/elasticsearch/xpack/idp/action/PutSamlServiceProviderRequestTests.java @@ -19,7 +19,7 @@ import org.elasticsearch.test.TestMatchers; import org.elasticsearch.test.VersionUtils; import org.elasticsearch.xpack.idp.saml.sp.SamlServiceProviderDocument; -import org.elasticsearch.xpack.idp.saml.sp.SamlServiceProviderIndexTests; +import org.elasticsearch.xpack.idp.saml.sp.SamlServiceProviderTestUtils; import org.hamcrest.MatcherAssert; import java.io.IOException; @@ -41,13 +41,13 @@ public class PutSamlServiceProviderRequestTests extends ESTestCase { public void testValidateSuccessfully() { - final SamlServiceProviderDocument doc = SamlServiceProviderIndexTests.randomDocument(); + final SamlServiceProviderDocument doc = SamlServiceProviderTestUtils.randomDocument(); final PutSamlServiceProviderRequest request = new PutSamlServiceProviderRequest(doc, randomFrom(RefreshPolicy.values())); assertThat(request.validate(), nullValue()); } public void testValidateAcs() { - final SamlServiceProviderDocument doc = SamlServiceProviderIndexTests.randomDocument(); + final SamlServiceProviderDocument doc = SamlServiceProviderTestUtils.randomDocument(); doc.acs = "this is not a URL"; final PutSamlServiceProviderRequest request = new PutSamlServiceProviderRequest(doc, randomFrom(RefreshPolicy.values())); final ActionRequestValidationException validationException = request.validate(); @@ -58,7 +58,7 @@ public void testValidateAcs() { } public void testValidateRequiredFields() { - final SamlServiceProviderDocument doc = SamlServiceProviderIndexTests.randomDocument(); + final SamlServiceProviderDocument doc = SamlServiceProviderTestUtils.randomDocument(); doc.name = null; doc.entityId = null; doc.acs = null; @@ -81,7 +81,7 @@ public void testValidateRequiredFields() { } public void testSerialization() throws IOException { - final SamlServiceProviderDocument doc = SamlServiceProviderIndexTests.randomDocument(); + final SamlServiceProviderDocument doc = SamlServiceProviderTestUtils.randomDocument(); final PutSamlServiceProviderRequest request = new PutSamlServiceProviderRequest(doc, RefreshPolicy.NONE); final Version version = VersionUtils.randomVersionBetween(random(), Version.V_7_7_0, Version.CURRENT); final PutSamlServiceProviderRequest read = copyWriteable(request, new NamedWriteableRegistry(List.of()), @@ -126,7 +126,7 @@ public void testParseRequestBodySuccessfully() throws Exception { } public void testParseRequestBodyFailsIfTimestampsAreIncluded() throws Exception { - final SamlServiceProviderDocument doc = SamlServiceProviderIndexTests.randomDocument(); + final SamlServiceProviderDocument doc = SamlServiceProviderTestUtils.randomDocument(); final Map fields = convertToMap(XContentType.JSON.xContent(), Strings.toString(doc), randomBoolean()); fields.remove("entity_id"); diff --git a/x-pack/plugin/identity-provider/src/test/java/org/elasticsearch/xpack/idp/action/TransportPutSamlServiceProviderActionTests.java b/x-pack/plugin/identity-provider/src/test/java/org/elasticsearch/xpack/idp/action/TransportPutSamlServiceProviderActionTests.java index dccb848e78210..463318de606c1 100644 --- a/x-pack/plugin/identity-provider/src/test/java/org/elasticsearch/xpack/idp/action/TransportPutSamlServiceProviderActionTests.java +++ b/x-pack/plugin/identity-provider/src/test/java/org/elasticsearch/xpack/idp/action/TransportPutSamlServiceProviderActionTests.java @@ -21,7 +21,7 @@ import org.elasticsearch.xpack.idp.saml.sp.SamlServiceProviderDocument; import org.elasticsearch.xpack.idp.saml.sp.SamlServiceProviderIndex; import org.elasticsearch.xpack.idp.saml.sp.SamlServiceProviderIndex.DocumentVersion; -import org.elasticsearch.xpack.idp.saml.sp.SamlServiceProviderIndexTests; +import org.elasticsearch.xpack.idp.saml.sp.SamlServiceProviderTestUtils; import org.hamcrest.Matchers; import org.junit.Before; @@ -64,7 +64,7 @@ public void setupMocks() { } public void testRegisterNewServiceProvider() throws Exception { - final SamlServiceProviderDocument document = SamlServiceProviderIndexTests.randomDocument(); + final SamlServiceProviderDocument document = SamlServiceProviderTestUtils.randomDocument(); mockExistingDocuments(document.entityId, Set.of()); @@ -88,9 +88,9 @@ public void testRegisterNewServiceProvider() throws Exception { } public void testUpdateExistingServiceProvider() throws Exception { - final SamlServiceProviderDocument document = SamlServiceProviderIndexTests.randomDocument(); + final SamlServiceProviderDocument document = SamlServiceProviderTestUtils.randomDocument(); - final SamlServiceProviderDocument existingDocument = SamlServiceProviderIndexTests.randomDocument(); + final SamlServiceProviderDocument existingDocument = SamlServiceProviderTestUtils.randomDocument(); existingDocument.entityId = document.entityId; existingDocument.docId = randomAlphaOfLength(42); mockExistingDocuments(document.entityId, Set.of(existingDocument)); @@ -116,7 +116,7 @@ public void testUpdateExistingServiceProvider() throws Exception { } public void testUnsupportedNameIDFormat() throws Exception { - final SamlServiceProviderDocument document = SamlServiceProviderIndexTests.randomDocument(); + final SamlServiceProviderDocument document = SamlServiceProviderTestUtils.randomDocument(); final String invalidFormat = randomFrom(PERSISTENT, EMAIL, randomAlphaOfLength(12)); document.setNameIdFormat(invalidFormat); diff --git a/x-pack/plugin/identity-provider/src/test/java/org/elasticsearch/xpack/idp/saml/sp/SamlServiceProviderResolverTests.java b/x-pack/plugin/identity-provider/src/test/java/org/elasticsearch/xpack/idp/saml/sp/SamlServiceProviderResolverTests.java index ef6ba191bc5e2..e77278af5d0ba 100644 --- a/x-pack/plugin/identity-provider/src/test/java/org/elasticsearch/xpack/idp/saml/sp/SamlServiceProviderResolverTests.java +++ b/x-pack/plugin/identity-provider/src/test/java/org/elasticsearch/xpack/idp/saml/sp/SamlServiceProviderResolverTests.java @@ -94,8 +94,8 @@ public void testResolveWithoutCache() throws Exception { } public void testResolveReturnsCachedObject() throws Exception { - final SamlServiceProviderDocument document1 = SamlServiceProviderIndexTests.randomDocument(1); - final SamlServiceProviderDocument document2 = SamlServiceProviderIndexTests.randomDocument(2); + final SamlServiceProviderDocument document1 = SamlServiceProviderTestUtils.randomDocument(1); + final SamlServiceProviderDocument document2 = SamlServiceProviderTestUtils.randomDocument(2); document2.entityId = document1.entityId; final DocumentVersion docVersion = new DocumentVersion(randomAlphaOfLength(12), 1, 1); @@ -110,8 +110,8 @@ public void testResolveReturnsCachedObject() throws Exception { } public void testResolveIgnoresCacheWhenDocumentVersionChanges() throws Exception { - final SamlServiceProviderDocument document1 = SamlServiceProviderIndexTests.randomDocument(1); - final SamlServiceProviderDocument document2 = SamlServiceProviderIndexTests.randomDocument(2); + final SamlServiceProviderDocument document1 = SamlServiceProviderTestUtils.randomDocument(1); + final SamlServiceProviderDocument document2 = SamlServiceProviderTestUtils.randomDocument(2); document2.entityId = document1.entityId; final DocumentVersion docVersion1 = new DocumentVersion(randomAlphaOfLength(12), 1, 1); diff --git a/x-pack/plugin/identity-provider/src/test/java/org/elasticsearch/xpack/idp/saml/sp/SamlServiceProviderTestUtils.java b/x-pack/plugin/identity-provider/src/test/java/org/elasticsearch/xpack/idp/saml/sp/SamlServiceProviderTestUtils.java new file mode 100644 index 0000000000000..0c884f2588611 --- /dev/null +++ b/x-pack/plugin/identity-provider/src/test/java/org/elasticsearch/xpack/idp/saml/sp/SamlServiceProviderTestUtils.java @@ -0,0 +1,79 @@ +/* + * 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.idp.saml.sp; + +import org.elasticsearch.common.unit.TimeValue; + +import java.util.HashSet; +import java.util.Set; + +import static org.elasticsearch.test.ESTestCase.randomAlphaOfLengthBetween; +import static org.elasticsearch.test.ESTestCase.randomBoolean; +import static org.elasticsearch.test.ESTestCase.randomFrom; +import static org.elasticsearch.test.ESTestCase.randomIntBetween; +import static org.elasticsearch.test.ESTestCase.randomLong; +import static org.hamcrest.Matchers.nullValue; +import static org.junit.Assert.assertThat; +import static org.opensaml.saml.saml2.core.NameIDType.TRANSIENT; + +public class SamlServiceProviderTestUtils { + + private SamlServiceProviderTestUtils(){} //utility class + + public static SamlServiceProviderDocument randomDocument() { + return randomDocument(randomIntBetween(1, 999_999)); + } + + public static SamlServiceProviderDocument randomDocument(int index) { + final SamlServiceProviderDocument document = new SamlServiceProviderDocument(); + document.setName(randomAlphaOfLengthBetween(5, 12)); + document.setEntityId(randomUri() + index); + document.setAcs(randomUri("https") + index + "/saml/acs"); + + document.setEnabled(randomBoolean()); + document.setCreatedMillis(System.currentTimeMillis() - TimeValue.timeValueDays(randomIntBetween(2, 90)).millis()); + document.setLastModifiedMillis(System.currentTimeMillis() - TimeValue.timeValueHours(randomIntBetween(1, 36)).millis()); + + if (randomBoolean()) { + document.setNameIdFormat(TRANSIENT); + } + if (randomBoolean()) { + document.setAuthenticationExpiryMillis(TimeValue.timeValueMinutes(randomIntBetween(1, 15)).millis()); + } + + document.privileges.setResource("app:" + randomAlphaOfLengthBetween(3, 6) + ":" + Math.abs(randomLong())); + final int roleCount = randomIntBetween(0, 4); + final Set roles = new HashSet<>(); + for (int i = 0; i < roleCount; i++) { + roles.add(randomAlphaOfLengthBetween(3, 6) + ":(" + randomAlphaOfLengthBetween(3, 6) + ")"); + } + document.privileges.setRolePatterns(roles); + + document.attributeNames.setPrincipal(randomUri()); + if (randomBoolean()) { + document.attributeNames.setName(randomUri()); + } + if (randomBoolean()) { + document.attributeNames.setEmail(randomUri()); + } + if (roles.isEmpty() == false) { + document.attributeNames.setRoles(randomUri()); + } + + assertThat(document.validate(), nullValue()); + return document; + } + + private static String randomUri() { + return randomUri(randomFrom("urn", "http", "https")); + } + + private static String randomUri(String scheme) { + return scheme + "://" + randomAlphaOfLengthBetween(2, 6) + "." + + randomAlphaOfLengthBetween(4, 8) + "." + randomAlphaOfLengthBetween(2, 4) + "/"; + } +} From 48163d54d7453205b34e9ced050520b779553e7d Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Wed, 5 Aug 2020 12:29:54 -0500 Subject: [PATCH 15/25] ilm --- x-pack/plugin/ilm/build.gradle | 1 + x-pack/plugin/ilm/qa/multi-node/build.gradle | 10 +- .../xpack/TimeSeriesRestDriver.java | 0 .../xpack/ilm/ChangePolicyforIndexIT.java | 0 .../xpack/ilm/TimeSeriesDataStreamsIT.java | 95 +++--- .../ilm/TimeSeriesLifecycleActionsIT.java | 302 +++++++++--------- .../xpack/slm/SnapshotLifecycleRestIT.java | 0 x-pack/plugin/ilm/qa/rest/build.gradle | 17 +- .../xpack/ilm/IndexLifecycleRestIT.java | 2 +- .../rest-api-spec/test/ilm/10_basic.yml | 0 .../rest-api-spec/test/ilm/11_basic_slm.yml | 0 .../test/ilm/20_move_to_step.yml | 0 .../rest-api-spec/test/ilm/30_retry.yml | 0 .../test/ilm/40_explain_lifecycle.yml | 0 .../test/ilm/60_operation_mode.yml | 0 .../test/ilm/60_remove_policy_for_index.yml | 0 .../plugin/ilm/qa/with-security/build.gradle | 10 +- .../xpack/security/PermissionsIT.java | 0 .../IndexLifecycleInitialisationTests.java | 0 .../xpack/ilm/UpdateSettingsStepTests.java | 0 .../slm/SLMSnapshotBlockingIntegTests.java | 0 .../SnapshotLifecycleInitialisationTests.java | 0 22 files changed, 205 insertions(+), 232 deletions(-) rename x-pack/plugin/ilm/qa/multi-node/src/{test => javaRestTest}/java/org/elasticsearch/xpack/TimeSeriesRestDriver.java (100%) rename x-pack/plugin/ilm/qa/multi-node/src/{test => javaRestTest}/java/org/elasticsearch/xpack/ilm/ChangePolicyforIndexIT.java (100%) rename x-pack/plugin/ilm/qa/multi-node/src/{test => javaRestTest}/java/org/elasticsearch/xpack/ilm/TimeSeriesDataStreamsIT.java (62%) rename x-pack/plugin/ilm/qa/multi-node/src/{test => javaRestTest}/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java (82%) rename x-pack/plugin/ilm/qa/multi-node/src/{test => javaRestTest}/java/org/elasticsearch/xpack/slm/SnapshotLifecycleRestIT.java (100%) rename x-pack/plugin/ilm/qa/rest/src/{test => yamlRestTest}/java/org/elasticsearch/xpack/ilm/IndexLifecycleRestIT.java (96%) rename x-pack/plugin/ilm/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/ilm/10_basic.yml (100%) rename x-pack/plugin/ilm/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/ilm/11_basic_slm.yml (100%) rename x-pack/plugin/ilm/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/ilm/20_move_to_step.yml (100%) rename x-pack/plugin/ilm/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/ilm/30_retry.yml (100%) rename x-pack/plugin/ilm/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/ilm/40_explain_lifecycle.yml (100%) rename x-pack/plugin/ilm/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/ilm/60_operation_mode.yml (100%) rename x-pack/plugin/ilm/qa/rest/src/{test => yamlRestTest}/resources/rest-api-spec/test/ilm/60_remove_policy_for_index.yml (100%) rename x-pack/plugin/ilm/qa/with-security/src/{test => javaRestTest}/java/org/elasticsearch/xpack/security/PermissionsIT.java (100%) rename x-pack/plugin/ilm/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ilm/IndexLifecycleInitialisationTests.java (100%) rename x-pack/plugin/ilm/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ilm/UpdateSettingsStepTests.java (100%) rename x-pack/plugin/ilm/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/slm/SLMSnapshotBlockingIntegTests.java (100%) rename x-pack/plugin/ilm/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/slm/SnapshotLifecycleInitialisationTests.java (100%) diff --git a/x-pack/plugin/ilm/build.gradle b/x-pack/plugin/ilm/build.gradle index b20ccea8b449a..e049ac7f2a2c3 100644 --- a/x-pack/plugin/ilm/build.gradle +++ b/x-pack/plugin/ilm/build.gradle @@ -1,4 +1,5 @@ apply plugin: 'elasticsearch.esplugin' +apply plugin: 'elasticsearch.internal-cluster-test' esplugin { name 'x-pack-ilm' diff --git a/x-pack/plugin/ilm/qa/multi-node/build.gradle b/x-pack/plugin/ilm/qa/multi-node/build.gradle index 5a44e71d2a4f7..9bcb5e7e72e03 100644 --- a/x-pack/plugin/ilm/qa/multi-node/build.gradle +++ b/x-pack/plugin/ilm/qa/multi-node/build.gradle @@ -1,21 +1,19 @@ import org.elasticsearch.gradle.info.BuildParams -apply plugin: 'elasticsearch.testclusters' -apply plugin: 'elasticsearch.standalone-rest-test' -apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.java-rest-test' dependencies { - testImplementation project(path: xpackProject('plugin').path, configuration: 'testArtifacts') + javaRestTestImplementation project(path: xpackProject('plugin').path, configuration: 'testArtifacts') } File repoDir = file("$buildDir/testclusters/repo") -integTest { +javaRestTest { /* To support taking index snapshots, we have to set path.repo setting */ systemProperty 'tests.path.repo', repoDir } -testClusters.integTest { +testClusters.all { testDistribution = 'DEFAULT' if (BuildParams.isSnapshotBuild() == false) { systemProperty 'es.searchable_snapshots_feature_enabled', 'true' diff --git a/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/TimeSeriesRestDriver.java b/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/TimeSeriesRestDriver.java similarity index 100% rename from x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/TimeSeriesRestDriver.java rename to x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/TimeSeriesRestDriver.java diff --git a/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/ilm/ChangePolicyforIndexIT.java b/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/ChangePolicyforIndexIT.java similarity index 100% rename from x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/ilm/ChangePolicyforIndexIT.java rename to x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/ChangePolicyforIndexIT.java diff --git a/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/ilm/TimeSeriesDataStreamsIT.java b/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesDataStreamsIT.java similarity index 62% rename from x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/ilm/TimeSeriesDataStreamsIT.java rename to x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesDataStreamsIT.java index e5cd67ae528b8..0fc800ed674f0 100644 --- a/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/ilm/TimeSeriesDataStreamsIT.java +++ b/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesDataStreamsIT.java @@ -17,6 +17,7 @@ import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.index.IndexSettings; import org.elasticsearch.test.rest.ESRestTestCase; +import org.elasticsearch.xpack.TimeSeriesRestDriver; import org.elasticsearch.xpack.core.ilm.CheckNotDataStreamWriteIndexStep; import org.elasticsearch.xpack.core.ilm.ForceMergeAction; import org.elasticsearch.xpack.core.ilm.FreezeAction; @@ -26,6 +27,7 @@ import org.elasticsearch.xpack.core.ilm.RolloverAction; import org.elasticsearch.xpack.core.ilm.SearchableSnapshotAction; import org.elasticsearch.xpack.core.ilm.ShrinkAction; +import org.hamcrest.Matchers; import java.io.IOException; import java.io.InputStream; @@ -33,15 +35,6 @@ import java.util.Map; import java.util.concurrent.TimeUnit; -import static org.elasticsearch.xpack.TimeSeriesRestDriver.createComposableTemplate; -import static org.elasticsearch.xpack.TimeSeriesRestDriver.createFullPolicy; -import static org.elasticsearch.xpack.TimeSeriesRestDriver.createNewSingletonPolicy; -import static org.elasticsearch.xpack.TimeSeriesRestDriver.createSnapshotRepo; -import static org.elasticsearch.xpack.TimeSeriesRestDriver.explainIndex; -import static org.elasticsearch.xpack.TimeSeriesRestDriver.getOnlyIndexSettings; -import static org.elasticsearch.xpack.TimeSeriesRestDriver.getStepKeyForIndex; -import static org.elasticsearch.xpack.TimeSeriesRestDriver.indexDocument; -import static org.elasticsearch.xpack.TimeSeriesRestDriver.rolloverMaxOneDocCondition; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; @@ -49,51 +42,51 @@ public class TimeSeriesDataStreamsIT extends ESRestTestCase { public void testRolloverAction() throws Exception { String policyName = "logs-policy"; - createNewSingletonPolicy(client(), policyName, "hot", new RolloverAction(null, null, 1L)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policyName, "hot", new RolloverAction(null, null, 1L)); - createComposableTemplate(client(), "logs-template", "logs-foo*", getTemplate(policyName)); + TimeSeriesRestDriver.createComposableTemplate(client(), "logs-template", "logs-foo*", getTemplate(policyName)); String dataStream = "logs-foo"; - indexDocument(client(), dataStream, true); + TimeSeriesRestDriver.indexDocument(client(), dataStream, true); assertBusy(() -> assertTrue(indexExists(DataStream.getDefaultBackingIndexName(dataStream, 2)))); assertBusy(() -> assertTrue(Boolean.parseBoolean((String) getIndexSettingsAsMap( DataStream.getDefaultBackingIndexName(dataStream, 2)).get("index.hidden")))); - assertBusy(() -> assertThat(getStepKeyForIndex(client(), DataStream.getDefaultBackingIndexName(dataStream, 1)), + assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), DataStream.getDefaultBackingIndexName(dataStream, 1)), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); } public void testShrinkActionInPolicyWithoutHotPhase() throws Exception { String policyName = "logs-policy"; - createNewSingletonPolicy(client(), policyName, "warm", new ShrinkAction(1)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policyName, "warm", new ShrinkAction(1)); - createComposableTemplate(client(), "logs-template", "logs-foo*", getTemplate(policyName)); + TimeSeriesRestDriver.createComposableTemplate(client(), "logs-template", "logs-foo*", getTemplate(policyName)); String dataStream = "logs-foo"; - indexDocument(client(), dataStream, true); + TimeSeriesRestDriver.indexDocument(client(), dataStream, true); String backingIndexName = DataStream.getDefaultBackingIndexName(dataStream, 1); String shrunkenIndex = ShrinkAction.SHRUNKEN_INDEX_PREFIX + backingIndexName; assertBusy(() -> assertThat( "original index must wait in the " + CheckNotDataStreamWriteIndexStep.NAME + " until it is not the write index anymore", - explainIndex(client(), backingIndexName).get("step"), is(CheckNotDataStreamWriteIndexStep.NAME)), 30, TimeUnit.SECONDS); + TimeSeriesRestDriver.explainIndex(client(), backingIndexName).get("step"), Matchers.is(CheckNotDataStreamWriteIndexStep.NAME)), 30, TimeUnit.SECONDS); // Manual rollover the original index such that it's not the write index in the data stream anymore - rolloverMaxOneDocCondition(client(), dataStream); + TimeSeriesRestDriver.rolloverMaxOneDocCondition(client(), dataStream); assertBusy(() -> assertTrue(indexExists(shrunkenIndex)), 30, TimeUnit.SECONDS); - assertBusy(() -> assertThat(getStepKeyForIndex(client(), shrunkenIndex), equalTo(PhaseCompleteStep.finalStep("warm").getKey()))); + assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), shrunkenIndex), equalTo(PhaseCompleteStep.finalStep("warm").getKey()))); assertBusy(() -> assertThat("the original index must've been deleted", indexExists(backingIndexName), is(false))); } public void testShrinkAfterRollover() throws Exception { String policyName = "logs-policy"; - createFullPolicy(client(), policyName, TimeValue.ZERO); + TimeSeriesRestDriver.createFullPolicy(client(), policyName, TimeValue.ZERO); - createComposableTemplate(client(), "logs-template", "logs-foo*", getTemplate(policyName)); + TimeSeriesRestDriver.createComposableTemplate(client(), "logs-template", "logs-foo*", getTemplate(policyName)); String dataStream = "logs-foo"; - indexDocument(client(), dataStream, true); + TimeSeriesRestDriver.indexDocument(client(), dataStream, true); String backingIndexName = DataStream.getDefaultBackingIndexName(dataStream, 1); String rolloverIndex = DataStream.getDefaultBackingIndexName(dataStream, 2); @@ -107,75 +100,75 @@ public void testShrinkAfterRollover() throws Exception { public void testSearchableSnapshotAction() throws Exception { String snapshotRepo = randomAlphaOfLengthBetween(5, 10); - createSnapshotRepo(client(), snapshotRepo, randomBoolean()); + TimeSeriesRestDriver.createSnapshotRepo(client(), snapshotRepo, randomBoolean()); String policyName = "logs-policy"; - createNewSingletonPolicy(client(), policyName, "cold", new SearchableSnapshotAction(snapshotRepo)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policyName, "cold", new SearchableSnapshotAction(snapshotRepo)); - createComposableTemplate(client(), "logs-template", "logs-foo*", getTemplate(policyName)); + TimeSeriesRestDriver.createComposableTemplate(client(), "logs-template", "logs-foo*", getTemplate(policyName)); String dataStream = "logs-foo"; - indexDocument(client(), dataStream, true); + TimeSeriesRestDriver.indexDocument(client(), dataStream, true); String backingIndexName = DataStream.getDefaultBackingIndexName(dataStream, 1); String restoredIndexName = SearchableSnapshotAction.RESTORED_INDEX_PREFIX + backingIndexName; assertBusy(() -> assertThat( "original index must wait in the " + CheckNotDataStreamWriteIndexStep.NAME + " until it is not the write index anymore", - explainIndex(client(), backingIndexName).get("step"), is(CheckNotDataStreamWriteIndexStep.NAME)), + TimeSeriesRestDriver.explainIndex(client(), backingIndexName).get("step"), Matchers.is(CheckNotDataStreamWriteIndexStep.NAME)), 30, TimeUnit.SECONDS); // Manual rollover the original index such that it's not the write index in the data stream anymore - rolloverMaxOneDocCondition(client(), dataStream); + TimeSeriesRestDriver.rolloverMaxOneDocCondition(client(), dataStream); assertBusy(() -> assertThat(indexExists(restoredIndexName), is(true))); assertBusy(() -> assertFalse(indexExists(backingIndexName)), 60, TimeUnit.SECONDS); - assertBusy(() -> assertThat(explainIndex(client(), restoredIndexName).get("step"), is(PhaseCompleteStep.NAME)), 30, + assertBusy(() -> assertThat(TimeSeriesRestDriver.explainIndex(client(), restoredIndexName).get("step"), Matchers.is(PhaseCompleteStep.NAME)), 30, TimeUnit.SECONDS); } public void testReadOnlyAction() throws Exception { String policyName = "logs-policy"; - createNewSingletonPolicy(client(), policyName, "warm", new ReadOnlyAction()); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policyName, "warm", new ReadOnlyAction()); - createComposableTemplate(client(), "logs-template", "logs-foo*", getTemplate(policyName)); + TimeSeriesRestDriver.createComposableTemplate(client(), "logs-template", "logs-foo*", getTemplate(policyName)); String dataStream = "logs-foo"; - indexDocument(client(), dataStream, true); + TimeSeriesRestDriver.indexDocument(client(), dataStream, true); String backingIndexName = DataStream.getDefaultBackingIndexName(dataStream, 1); assertBusy(() -> assertThat( "index must wait in the " + CheckNotDataStreamWriteIndexStep.NAME + " until it is not the write index anymore", - explainIndex(client(), backingIndexName).get("step"), is(CheckNotDataStreamWriteIndexStep.NAME)), + TimeSeriesRestDriver.explainIndex(client(), backingIndexName).get("step"), Matchers.is(CheckNotDataStreamWriteIndexStep.NAME)), 30, TimeUnit.SECONDS); // Manual rollover the original index such that it's not the write index in the data stream anymore - rolloverMaxOneDocCondition(client(), dataStream); + TimeSeriesRestDriver.rolloverMaxOneDocCondition(client(), dataStream); - assertBusy(() -> assertThat(explainIndex(client(), backingIndexName).get("step"), is(PhaseCompleteStep.NAME)), 30, + assertBusy(() -> assertThat(TimeSeriesRestDriver.explainIndex(client(), backingIndexName).get("step"), Matchers.is(PhaseCompleteStep.NAME)), 30, TimeUnit.SECONDS); - assertThat(getOnlyIndexSettings(client(), backingIndexName).get(IndexMetadata.INDEX_BLOCKS_WRITE_SETTING.getKey()), + assertThat(TimeSeriesRestDriver.getOnlyIndexSettings(client(), backingIndexName).get(IndexMetadata.INDEX_BLOCKS_WRITE_SETTING.getKey()), equalTo("true")); } public void testFreezeAction() throws Exception { String policyName = "logs-policy"; - createNewSingletonPolicy(client(), policyName, "cold", new FreezeAction()); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policyName, "cold", new FreezeAction()); - createComposableTemplate(client(), "logs-template", "logs-foo*", getTemplate(policyName)); + TimeSeriesRestDriver.createComposableTemplate(client(), "logs-template", "logs-foo*", getTemplate(policyName)); String dataStream = "logs-foo"; - indexDocument(client(), dataStream, true); + TimeSeriesRestDriver.indexDocument(client(), dataStream, true); String backingIndexName = DataStream.getDefaultBackingIndexName(dataStream, 1); assertBusy(() -> assertThat( "index must wait in the " + CheckNotDataStreamWriteIndexStep.NAME + " until it is not the write index anymore", - explainIndex(client(), backingIndexName).get("step"), is(CheckNotDataStreamWriteIndexStep.NAME)), + TimeSeriesRestDriver.explainIndex(client(), backingIndexName).get("step"), Matchers.is(CheckNotDataStreamWriteIndexStep.NAME)), 30, TimeUnit.SECONDS); // Manual rollover the original index such that it's not the write index in the data stream anymore - rolloverMaxOneDocCondition(client(), dataStream); + TimeSeriesRestDriver.rolloverMaxOneDocCondition(client(), dataStream); - assertBusy(() -> assertThat(explainIndex(client(), backingIndexName).get("step"), is(PhaseCompleteStep.NAME)), 30, + assertBusy(() -> assertThat(TimeSeriesRestDriver.explainIndex(client(), backingIndexName).get("step"), Matchers.is(PhaseCompleteStep.NAME)), 30, TimeUnit.SECONDS); - Map settings = getOnlyIndexSettings(client(), backingIndexName); + Map settings = TimeSeriesRestDriver.getOnlyIndexSettings(client(), backingIndexName); assertThat(settings.get(IndexMetadata.SETTING_BLOCKS_WRITE), equalTo("true")); assertThat(settings.get(IndexSettings.INDEX_SEARCH_THROTTLED.getKey()), equalTo("true")); assertThat(settings.get("index.frozen"), equalTo("true")); @@ -183,31 +176,31 @@ public void testFreezeAction() throws Exception { public void testForceMergeAction() throws Exception { String policyName = "logs-policy"; - createNewSingletonPolicy(client(), policyName, "warm", new ForceMergeAction(1, null)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policyName, "warm", new ForceMergeAction(1, null)); - createComposableTemplate(client(), "logs-template", "logs-foo*", getTemplate(policyName)); + TimeSeriesRestDriver.createComposableTemplate(client(), "logs-template", "logs-foo*", getTemplate(policyName)); String dataStream = "logs-foo"; - indexDocument(client(), dataStream, true); + TimeSeriesRestDriver.indexDocument(client(), dataStream, true); String backingIndexName = DataStream.getDefaultBackingIndexName(dataStream, 1); assertBusy(() -> assertThat( "index must wait in the " + CheckNotDataStreamWriteIndexStep.NAME + " until it is not the write index anymore", - explainIndex(client(), backingIndexName).get("step"), is(CheckNotDataStreamWriteIndexStep.NAME)), + TimeSeriesRestDriver.explainIndex(client(), backingIndexName).get("step"), Matchers.is(CheckNotDataStreamWriteIndexStep.NAME)), 30, TimeUnit.SECONDS); // Manual rollover the original index such that it's not the write index in the data stream anymore - rolloverMaxOneDocCondition(client(), dataStream); + TimeSeriesRestDriver.rolloverMaxOneDocCondition(client(), dataStream); - assertBusy(() -> assertThat(explainIndex(client(), backingIndexName).get("step"), is(PhaseCompleteStep.NAME)), 30, + assertBusy(() -> assertThat(TimeSeriesRestDriver.explainIndex(client(), backingIndexName).get("step"), Matchers.is(PhaseCompleteStep.NAME)), 30, TimeUnit.SECONDS); } @SuppressWarnings("unchecked") public void testGetDataStreamReturnsILMPolicy() throws Exception { String policyName = "logs-policy"; - createComposableTemplate(client(), "logs-template", "logs-foo*", getTemplate(policyName)); + TimeSeriesRestDriver.createComposableTemplate(client(), "logs-template", "logs-foo*", getTemplate(policyName)); String dataStream = "logs-foo"; - indexDocument(client(), dataStream, true); + TimeSeriesRestDriver.indexDocument(client(), dataStream, true); Request explainRequest = new Request("GET", "/_data_stream/logs-foo"); Response response = client().performRequest(explainRequest); diff --git a/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java b/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java similarity index 82% rename from x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java rename to x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java index 0adf7f87385e9..60982a7e0bec9 100644 --- a/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java +++ b/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java @@ -28,6 +28,7 @@ import org.elasticsearch.index.IndexSettings; import org.elasticsearch.snapshots.SnapshotState; import org.elasticsearch.test.rest.ESRestTestCase; +import org.elasticsearch.xpack.TimeSeriesRestDriver; import org.elasticsearch.xpack.core.ilm.AllocateAction; import org.elasticsearch.xpack.core.ilm.DeleteAction; import org.elasticsearch.xpack.core.ilm.ForceMergeAction; @@ -66,15 +67,6 @@ import static java.util.Collections.singletonMap; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; -import static org.elasticsearch.xpack.TimeSeriesRestDriver.createFullPolicy; -import static org.elasticsearch.xpack.TimeSeriesRestDriver.createNewSingletonPolicy; -import static org.elasticsearch.xpack.TimeSeriesRestDriver.createSnapshotRepo; -import static org.elasticsearch.xpack.TimeSeriesRestDriver.explain; -import static org.elasticsearch.xpack.TimeSeriesRestDriver.explainIndex; -import static org.elasticsearch.xpack.TimeSeriesRestDriver.getOnlyIndexSettings; -import static org.elasticsearch.xpack.TimeSeriesRestDriver.getStepKeyForIndex; -import static org.elasticsearch.xpack.TimeSeriesRestDriver.indexDocument; -import static org.elasticsearch.xpack.TimeSeriesRestDriver.rolloverMaxOneDocCondition; import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; @@ -119,7 +111,7 @@ public void testFullPolicy() throws Exception { .put(RolloverAction.LIFECYCLE_ROLLOVER_ALIAS, alias)); // create policy - createFullPolicy(client(), policy, TimeValue.ZERO); + TimeSeriesRestDriver.createFullPolicy(client(), policy, TimeValue.ZERO); // update policy on index updatePolicy(originalIndex, policy); // index document {"foo": "bar"} to trigger rollover @@ -147,13 +139,13 @@ public void testMoveToAllocateStep() throws Exception { .put(RolloverAction.LIFECYCLE_ROLLOVER_ALIAS, "alias")); // create policy - createFullPolicy(client(), policy, TimeValue.timeValueHours(10)); + TimeSeriesRestDriver.createFullPolicy(client(), policy, TimeValue.timeValueHours(10)); // update policy on index updatePolicy(originalIndex, policy); // move to a step Request moveToStepRequest = new Request("POST", "_ilm/move/" + originalIndex); - assertBusy(() -> assertTrue(getStepKeyForIndex(client(), originalIndex).equals(new StepKey("new", "complete", "complete")))); + assertBusy(() -> assertTrue(TimeSeriesRestDriver.getStepKeyForIndex(client(), originalIndex).equals(new StepKey("new", "complete", "complete")))); moveToStepRequest.setJsonEntity("{\n" + " \"current_step\": {\n" + " \"phase\": \"new\",\n" + @@ -180,7 +172,7 @@ public void testMoveToRolloverStep() throws Exception { .put("index.routing.allocation.include._name", "integTest-0") .put(RolloverAction.LIFECYCLE_ROLLOVER_ALIAS, alias)); - createFullPolicy(client(), policy, TimeValue.timeValueHours(10)); + TimeSeriesRestDriver.createFullPolicy(client(), policy, TimeValue.timeValueHours(10)); // update policy on index updatePolicy(originalIndex, policy); @@ -188,7 +180,7 @@ public void testMoveToRolloverStep() throws Exception { Request moveToStepRequest = new Request("POST", "_ilm/move/" + originalIndex); // index document to trigger rollover index(client(), originalIndex, "_id", "foo", "bar"); - logger.info(getStepKeyForIndex(client(), originalIndex)); + logger.info(TimeSeriesRestDriver.getStepKeyForIndex(client(), originalIndex)); moveToStepRequest.setJsonEntity("{\n" + " \"current_step\": {\n" + " \"phase\": \"new\",\n" + @@ -218,14 +210,14 @@ public void testMoveToRolloverStep() throws Exception { } public void testRetryFailedDeleteAction() throws Exception { - createNewSingletonPolicy(client(), policy, "delete", new DeleteAction()); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "delete", new DeleteAction()); createIndexWithSettings(index, Settings.builder() .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) .put(IndexMetadata.SETTING_READ_ONLY, true) .put("index.lifecycle.name", policy)); - assertBusy(() -> assertThat((Integer) explainIndex(client(), index).get(FAILED_STEP_RETRY_COUNT_FIELD), greaterThanOrEqualTo(1)), + assertBusy(() -> assertThat((Integer) TimeSeriesRestDriver.explainIndex(client(), index).get(FAILED_STEP_RETRY_COUNT_FIELD), greaterThanOrEqualTo(1)), 30, TimeUnit.SECONDS); assertTrue(indexExists(index)); @@ -237,7 +229,7 @@ public void testRetryFailedDeleteAction() throws Exception { } public void testRetryFreezeDeleteAction() throws Exception { - createNewSingletonPolicy(client(), policy, "cold", new FreezeAction()); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "cold", new FreezeAction()); createIndexWithSettings(index, Settings.builder() .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) @@ -245,15 +237,15 @@ public void testRetryFreezeDeleteAction() throws Exception { .put(IndexMetadata.SETTING_READ_ONLY, true) .put("index.lifecycle.name", policy)); - assertBusy(() -> assertThat((Integer) explainIndex(client(), index).get(FAILED_STEP_RETRY_COUNT_FIELD), greaterThanOrEqualTo(1)), + assertBusy(() -> assertThat((Integer) TimeSeriesRestDriver.explainIndex(client(), index).get(FAILED_STEP_RETRY_COUNT_FIELD), greaterThanOrEqualTo(1)), 30, TimeUnit.SECONDS); - assertFalse(getOnlyIndexSettings(client(), index).containsKey("index.frozen")); + assertFalse(TimeSeriesRestDriver.getOnlyIndexSettings(client(), index).containsKey("index.frozen")); Request request = new Request("PUT", index + "/_settings"); request.setJsonEntity("{\"index.blocks.read_only\":false}"); assertOK(client().performRequest(request)); - assertBusy(() -> assertThat(getOnlyIndexSettings(client(), index).get("index.frozen"), equalTo("true"))); + assertBusy(() -> assertThat(TimeSeriesRestDriver.getOnlyIndexSettings(client(), index).get("index.frozen"), equalTo("true"))); } public void testRetryFailedShrinkAction() throws Exception { @@ -263,7 +255,7 @@ public void testRetryFailedShrinkAction() throws Exception { String shrunkenIndex = ShrinkAction.SHRUNKEN_INDEX_PREFIX + index; createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, numShards) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)); - createNewSingletonPolicy(client(), policy, "warm", new ShrinkAction(numShards + randomIntBetween(1, numShards))); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "warm", new ShrinkAction(numShards + randomIntBetween(1, numShards))); updatePolicy(index, policy); assertBusy(() -> { String failedStep = getFailedStepForIndex(index); @@ -271,7 +263,7 @@ public void testRetryFailedShrinkAction() throws Exception { }); // update policy to be correct - createNewSingletonPolicy(client(), policy, "warm", new ShrinkAction(expectedFinalShards)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "warm", new ShrinkAction(expectedFinalShards)); updatePolicy(index, policy); // retry step @@ -281,14 +273,14 @@ public void testRetryFailedShrinkAction() throws Exception { // assert corrected policy is picked up and index is shrunken assertBusy(() -> assertTrue(indexExists(shrunkenIndex)), 30, TimeUnit.SECONDS); assertBusy(() -> assertTrue(aliasExists(shrunkenIndex, index))); - assertBusy(() -> assertThat(getStepKeyForIndex(client(), shrunkenIndex), equalTo(PhaseCompleteStep.finalStep("warm").getKey()))); + assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), shrunkenIndex), equalTo(PhaseCompleteStep.finalStep("warm").getKey()))); assertBusy(() -> { - Map settings = getOnlyIndexSettings(client(), shrunkenIndex); + Map settings = TimeSeriesRestDriver.getOnlyIndexSettings(client(), shrunkenIndex); assertThat(settings.get(IndexMetadata.SETTING_NUMBER_OF_SHARDS), equalTo(String.valueOf(expectedFinalShards))); assertThat(settings.get(IndexMetadata.INDEX_BLOCKS_WRITE_SETTING.getKey()), equalTo("true")); assertThat(settings.get(IndexMetadata.INDEX_ROUTING_REQUIRE_GROUP_SETTING.getKey() + "_id"), nullValue()); }); - expectThrows(ResponseException.class, () -> indexDocument(client(), index)); + expectThrows(ResponseException.class, () -> TimeSeriesRestDriver.indexDocument(client(), index)); } public void testRolloverAction() throws Exception { @@ -299,7 +291,7 @@ public void testRolloverAction() throws Exception { .put(RolloverAction.LIFECYCLE_ROLLOVER_ALIAS, alias)); // create policy - createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); // update policy on index updatePolicy(originalIndex, policy); // index document {"foo": "bar"} to trigger rollover @@ -307,7 +299,7 @@ public void testRolloverAction() throws Exception { assertBusy(() -> assertTrue(indexExists(secondIndex))); assertBusy(() -> assertTrue(indexExists(originalIndex))); assertBusy(() -> assertEquals("true", - getOnlyIndexSettings(client(), originalIndex).get(LifecycleSettings.LIFECYCLE_INDEXING_COMPLETE))); + TimeSeriesRestDriver.getOnlyIndexSettings(client(), originalIndex).get(LifecycleSettings.LIFECYCLE_INDEXING_COMPLETE))); } public void testRolloverActionWithIndexingComplete() throws Exception { @@ -339,16 +331,16 @@ public void testRolloverActionWithIndexingComplete() throws Exception { client().performRequest(updateAliasRequest); // create policy - createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); // update policy on index updatePolicy(originalIndex, policy); // index document {"foo": "bar"} to trigger rollover index(client(), originalIndex, "_id", "foo", "bar"); - assertBusy(() -> assertThat(getStepKeyForIndex(client(), originalIndex), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); + assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), originalIndex), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); assertBusy(() -> assertTrue(indexExists(originalIndex))); assertBusy(() -> assertFalse(indexExists(secondIndex))); assertBusy(() -> assertEquals("true", - getOnlyIndexSettings(client(), originalIndex).get(LifecycleSettings.LIFECYCLE_INDEXING_COMPLETE))); + TimeSeriesRestDriver.getOnlyIndexSettings(client(), originalIndex).get(LifecycleSettings.LIFECYCLE_INDEXING_COMPLETE))); } public void testAllocateOnlyAllocation() throws Exception { @@ -357,10 +349,10 @@ public void testAllocateOnlyAllocation() throws Exception { String allocateNodeName = "integTest-" + randomFrom(0, 1); AllocateAction allocateAction = new AllocateAction(null, null, null, singletonMap("_name", allocateNodeName)); String endPhase = randomFrom("warm", "cold"); - createNewSingletonPolicy(client(), policy, endPhase, allocateAction); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, endPhase, allocateAction); updatePolicy(index, policy); assertBusy(() -> { - assertThat(getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep(endPhase).getKey())); + assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep(endPhase).getKey())); }); ensureGreen(index); } @@ -373,11 +365,11 @@ public void testAllocateActionOnlyReplicas() throws Exception { .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, numReplicas)); AllocateAction allocateAction = new AllocateAction(finalNumReplicas, null, null, null); String endPhase = randomFrom("warm", "cold"); - createNewSingletonPolicy(client(), policy, endPhase, allocateAction); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, endPhase, allocateAction); updatePolicy(index, policy); assertBusy(() -> { - Map settings = getOnlyIndexSettings(client(), index); - assertThat(getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep(endPhase).getKey())); + Map settings = TimeSeriesRestDriver.getOnlyIndexSettings(client(), index); + assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep(endPhase).getKey())); assertThat(settings.get(IndexMetadata.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey()), equalTo(String.valueOf(finalNumReplicas))); }); } @@ -386,20 +378,20 @@ public void testWaitForSnapshot() throws Exception { createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)); String slmPolicy = randomAlphaOfLengthBetween(4, 10); - createNewSingletonPolicy(client(), policy, "delete", new WaitForSnapshotAction(slmPolicy)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "delete", new WaitForSnapshotAction(slmPolicy)); updatePolicy(index, policy); assertBusy( () -> { - Map indexILMState = explainIndex(client(), index); + Map indexILMState = TimeSeriesRestDriver.explainIndex(client(), index); assertThat(indexILMState.get("action"), is("wait_for_snapshot")); assertThat(indexILMState.get("failed_step"), is("wait-for-snapshot")); }, slmPolicy); String snapshotRepo = randomAlphaOfLengthBetween(4, 10); - createSnapshotRepo(client(), snapshotRepo, randomBoolean()); + TimeSeriesRestDriver.createSnapshotRepo(client(), snapshotRepo, randomBoolean()); createSlmPolicy(slmPolicy, snapshotRepo); assertBusy( () -> { - Map indexILMState = explainIndex(client(), index); + Map indexILMState = TimeSeriesRestDriver.explainIndex(client(), index); //wait for step to notice that the slm policy is created and to get out of error assertThat(indexILMState.get("failed_step"), nullValue()); assertThat(indexILMState.get("action"), is("wait_for_snapshot")); @@ -409,17 +401,17 @@ public void testWaitForSnapshot() throws Exception { Request request = new Request("PUT", "/_slm/policy/" + slmPolicy + "/_execute"); assertOK(client().performRequest(request)); - assertBusy(() -> assertThat(getStepKeyForIndex(client(), index).getAction(), equalTo("complete")), slmPolicy); + assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index).getAction(), equalTo("complete")), slmPolicy); } public void testWaitForSnapshotSlmExecutedBefore() throws Exception { createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)); String slmPolicy = randomAlphaOfLengthBetween(4, 10); - createNewSingletonPolicy(client(), policy, "delete", new WaitForSnapshotAction(slmPolicy)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "delete", new WaitForSnapshotAction(slmPolicy)); String snapshotRepo = randomAlphaOfLengthBetween(4, 10); - createSnapshotRepo(client(), snapshotRepo, randomBoolean()); + TimeSeriesRestDriver.createSnapshotRepo(client(), snapshotRepo, randomBoolean()); createSlmPolicy(slmPolicy, snapshotRepo); Request request = new Request("PUT", "/_slm/policy/" + slmPolicy + "/_execute"); @@ -437,7 +429,7 @@ public void testWaitForSnapshotSlmExecutedBefore() throws Exception { updatePolicy(index, policy); assertBusy( () -> { - Map indexILMState = explainIndex(client(), index); + Map indexILMState = TimeSeriesRestDriver.explainIndex(client(), index); assertThat(indexILMState.get("failed_step"), nullValue()); assertThat(indexILMState.get("action"), is("wait_for_snapshot")); assertThat(indexILMState.get("step"), is("wait-for-snapshot")); @@ -455,13 +447,13 @@ public void testWaitForSnapshotSlmExecutedBefore() throws Exception { } }, slmPolicy); - assertBusy(() -> assertThat(getStepKeyForIndex(client(), index).getAction(), equalTo("complete")), slmPolicy); + assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index).getAction(), equalTo("complete")), slmPolicy); } public void testDelete() throws Exception { createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)); - createNewSingletonPolicy(client(), policy, "delete", new DeleteAction()); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "delete", new DeleteAction()); updatePolicy(index, policy); assertBusy(() -> assertFalse(indexExists(index))); } @@ -469,14 +461,14 @@ public void testDelete() throws Exception { public void testDeleteOnlyShouldNotMakeIndexReadonly() throws Exception { createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)); - createNewSingletonPolicy(client(), policy, "delete", new DeleteAction(), TimeValue.timeValueHours(1)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "delete", new DeleteAction(), TimeValue.timeValueHours(1)); updatePolicy(index, policy); assertBusy(() -> { - assertThat(getStepKeyForIndex(client(), index).getAction(), equalTo("complete")); - Map settings = getOnlyIndexSettings(client(), index); + assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index).getAction(), equalTo("complete")); + Map settings = TimeSeriesRestDriver.getOnlyIndexSettings(client(), index); assertThat(settings.get(IndexMetadata.INDEX_BLOCKS_WRITE_SETTING.getKey()), not("true")); }); - indexDocument(client(), index); + TimeSeriesRestDriver.indexDocument(client(), index); } public void testDeleteDuringSnapshot() throws Exception { @@ -494,12 +486,12 @@ public void testDeleteDuringSnapshot() throws Exception { .endObject())); assertOK(client().performRequest(request)); // create delete policy - createNewSingletonPolicy(client(), policy, "delete", new DeleteAction(), TimeValue.timeValueMillis(0)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "delete", new DeleteAction(), TimeValue.timeValueMillis(0)); // create index without policy createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)); // index document so snapshot actually does something - indexDocument(client(), index); + TimeSeriesRestDriver.indexDocument(client(), index); // start snapshot String snapName = "snapshot-" + randomAlphaOfLength(6).toLowerCase(Locale.ROOT); request = new Request("PUT", "/_snapshot/repo/" + snapName); @@ -518,11 +510,11 @@ public void testDeleteDuringSnapshot() throws Exception { public void testReadOnly() throws Exception { createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)); - createNewSingletonPolicy(client(), policy, "warm", new ReadOnlyAction()); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "warm", new ReadOnlyAction()); updatePolicy(index, policy); assertBusy(() -> { - Map settings = getOnlyIndexSettings(client(), index); - assertThat(getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("warm").getKey())); + Map settings = TimeSeriesRestDriver.getOnlyIndexSettings(client(), index); + assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("warm").getKey())); assertThat(settings.get(IndexMetadata.INDEX_BLOCKS_WRITE_SETTING.getKey()), equalTo("true")); }); } @@ -551,16 +543,16 @@ public void forceMergeActionWithCodec(String codec) throws Exception { } }; assertThat(numSegments.get(), greaterThan(1)); - createNewSingletonPolicy(client(), policy, "warm", new ForceMergeAction(1, codec)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "warm", new ForceMergeAction(1, codec)); updatePolicy(index, policy); assertBusy(() -> { - assertThat(getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("warm").getKey())); - Map settings = getOnlyIndexSettings(client(), index); + assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("warm").getKey())); + Map settings = TimeSeriesRestDriver.getOnlyIndexSettings(client(), index); assertThat(numSegments.get(), equalTo(1)); assertThat(settings.get(IndexMetadata.INDEX_BLOCKS_WRITE_SETTING.getKey()), equalTo("true")); }); - expectThrows(ResponseException.class, () -> indexDocument(client(), index)); + expectThrows(ResponseException.class, () -> TimeSeriesRestDriver.indexDocument(client(), index)); } public void testForceMergeAction() throws Exception { @@ -574,18 +566,18 @@ public void testShrinkAction() throws Exception { String shrunkenIndex = ShrinkAction.SHRUNKEN_INDEX_PREFIX + index; createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, numShards) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)); - createNewSingletonPolicy(client(), policy, "warm", new ShrinkAction(expectedFinalShards)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "warm", new ShrinkAction(expectedFinalShards)); updatePolicy(index, policy); assertBusy(() -> assertTrue(indexExists(shrunkenIndex)), 30, TimeUnit.SECONDS); assertBusy(() -> assertTrue(aliasExists(shrunkenIndex, index))); - assertBusy(() -> assertThat(getStepKeyForIndex(client(), shrunkenIndex), equalTo(PhaseCompleteStep.finalStep("warm").getKey()))); + assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), shrunkenIndex), equalTo(PhaseCompleteStep.finalStep("warm").getKey()))); assertBusy(() -> { - Map settings = getOnlyIndexSettings(client(), shrunkenIndex); + Map settings = TimeSeriesRestDriver.getOnlyIndexSettings(client(), shrunkenIndex); assertThat(settings.get(IndexMetadata.SETTING_NUMBER_OF_SHARDS), equalTo(String.valueOf(expectedFinalShards))); assertThat(settings.get(IndexMetadata.INDEX_BLOCKS_WRITE_SETTING.getKey()), equalTo("true")); assertThat(settings.get(IndexMetadata.INDEX_ROUTING_REQUIRE_GROUP_SETTING.getKey() + "_id"), nullValue()); }); - expectThrows(ResponseException.class, () -> indexDocument(client(), index)); + expectThrows(ResponseException.class, () -> TimeSeriesRestDriver.indexDocument(client(), index)); } public void testShrinkSameShards() throws Exception { @@ -593,14 +585,14 @@ public void testShrinkSameShards() throws Exception { String shrunkenIndex = ShrinkAction.SHRUNKEN_INDEX_PREFIX + index; createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, numberOfShards) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)); - createNewSingletonPolicy(client(), policy, "warm", new ShrinkAction(numberOfShards)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "warm", new ShrinkAction(numberOfShards)); updatePolicy(index, policy); assertBusy(() -> { assertTrue(indexExists(index)); assertFalse(indexExists(shrunkenIndex)); assertFalse(aliasExists(shrunkenIndex, index)); - Map settings = getOnlyIndexSettings(client(), index); - assertThat(getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("warm").getKey())); + Map settings = TimeSeriesRestDriver.getOnlyIndexSettings(client(), index); + assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("warm").getKey())); assertThat(settings.get(IndexMetadata.SETTING_NUMBER_OF_SHARDS), equalTo(String.valueOf(numberOfShards))); assertNull(settings.get(IndexMetadata.INDEX_BLOCKS_WRITE_SETTING.getKey())); assertThat(settings.get(IndexMetadata.INDEX_ROUTING_REQUIRE_GROUP_SETTING.getKey() + "_id"), nullValue()); @@ -623,7 +615,7 @@ public void testShrinkDuringSnapshot() throws Exception { .endObject())); assertOK(client().performRequest(request)); // create delete policy - createNewSingletonPolicy(client(), policy, "warm", new ShrinkAction(1), TimeValue.timeValueMillis(0)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "warm", new ShrinkAction(1), TimeValue.timeValueMillis(0)); // create index without policy createIndexWithSettings(index, Settings.builder() .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 2) @@ -631,7 +623,7 @@ public void testShrinkDuringSnapshot() throws Exception { // required so the shrink doesn't wait on SetSingleNodeAllocateStep .put(IndexMetadata.INDEX_ROUTING_REQUIRE_GROUP_SETTING.getKey() + "_name", "integTest-0")); // index document so snapshot actually does something - indexDocument(client(), index); + TimeSeriesRestDriver.indexDocument(client(), index); // start snapshot request = new Request("PUT", "/_snapshot/repo/snapshot"); request.addParameter("wait_for_completion", "false"); @@ -643,13 +635,13 @@ public void testShrinkDuringSnapshot() throws Exception { assertBusy(() -> { assertTrue(indexExists(shrunkenIndex)); assertTrue(aliasExists(shrunkenIndex, index)); - Map settings = getOnlyIndexSettings(client(), shrunkenIndex); - assertThat(getStepKeyForIndex(client(), shrunkenIndex), equalTo(PhaseCompleteStep.finalStep("warm").getKey())); + Map settings = TimeSeriesRestDriver.getOnlyIndexSettings(client(), shrunkenIndex); + assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), shrunkenIndex), equalTo(PhaseCompleteStep.finalStep("warm").getKey())); assertThat(settings.get(IndexMetadata.SETTING_NUMBER_OF_SHARDS), equalTo(String.valueOf(1))); assertThat(settings.get(IndexMetadata.INDEX_BLOCKS_WRITE_SETTING.getKey()), equalTo("true")); assertThat(settings.get(IndexMetadata.INDEX_ROUTING_REQUIRE_GROUP_SETTING.getKey() + "_id"), nullValue()); }, 2, TimeUnit.MINUTES); - expectThrows(ResponseException.class, () -> indexDocument(client(), index)); + expectThrows(ResponseException.class, () -> TimeSeriesRestDriver.indexDocument(client(), index)); // assert that snapshot succeeded assertThat(getSnapshotState("snapshot"), equalTo("SUCCESS")); assertOK(client().performRequest(new Request("DELETE", "/_snapshot/repo/snapshot"))); @@ -680,12 +672,12 @@ public void testSetSingleNodeAllocationRetriesUntilItSucceeds() throws Exception }); // assign the policy that'll attempt to shrink the index - createNewSingletonPolicy(client(), policy, "warm", new ShrinkAction(expectedFinalShards)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "warm", new ShrinkAction(expectedFinalShards)); updatePolicy(index, policy); assertTrue("ILM did not start retrying the set-single-node-allocation step", waitUntil(() -> { try { - Map explainIndexResponse = explainIndex(client(), index); + Map explainIndexResponse = TimeSeriesRestDriver.explainIndex(client(), index); if (explainIndexResponse == null) { return false; } @@ -707,17 +699,17 @@ public void testSetSingleNodeAllocationRetriesUntilItSucceeds() throws Exception assertBusy(() -> assertTrue(indexExists(shrunkenIndex)), 30, TimeUnit.SECONDS); assertBusy(() -> assertTrue(aliasExists(shrunkenIndex, index))); - assertBusy(() -> assertThat(getStepKeyForIndex(client(), shrunkenIndex), equalTo(PhaseCompleteStep.finalStep("warm").getKey()))); + assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), shrunkenIndex), equalTo(PhaseCompleteStep.finalStep("warm").getKey()))); } public void testFreezeAction() throws Exception { createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)); - createNewSingletonPolicy(client(), policy, "cold", new FreezeAction()); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "cold", new FreezeAction()); updatePolicy(index, policy); assertBusy(() -> { - Map settings = getOnlyIndexSettings(client(), index); - assertThat(getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("cold").getKey())); + Map settings = TimeSeriesRestDriver.getOnlyIndexSettings(client(), index); + assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("cold").getKey())); assertThat(settings.get(IndexMetadata.INDEX_BLOCKS_WRITE_SETTING.getKey()), equalTo("true")); assertThat(settings.get(IndexSettings.INDEX_SEARCH_THROTTLED.getKey()), equalTo("true")); assertThat(settings.get("index.frozen"), equalTo("true")); @@ -739,12 +731,12 @@ public void testFreezeDuringSnapshot() throws Exception { .endObject())); assertOK(client().performRequest(request)); // create delete policy - createNewSingletonPolicy(client(), policy, "cold", new FreezeAction(), TimeValue.timeValueMillis(0)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "cold", new FreezeAction(), TimeValue.timeValueMillis(0)); // create index without policy createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)); // index document so snapshot actually does something - indexDocument(client(), index); + TimeSeriesRestDriver.indexDocument(client(), index); // start snapshot request = new Request("PUT", "/_snapshot/repo/snapshot"); request.addParameter("wait_for_completion", "false"); @@ -754,8 +746,8 @@ public void testFreezeDuringSnapshot() throws Exception { updatePolicy(index, policy); // assert that the index froze assertBusy(() -> { - Map settings = getOnlyIndexSettings(client(), index); - assertThat(getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("cold").getKey())); + Map settings = TimeSeriesRestDriver.getOnlyIndexSettings(client(), index); + assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("cold").getKey())); assertThat(settings.get(IndexMetadata.INDEX_BLOCKS_WRITE_SETTING.getKey()), equalTo("true")); assertThat(settings.get(IndexSettings.INDEX_SEARCH_THROTTLED.getKey()), equalTo("true")); assertThat(settings.get("index.frozen"), equalTo("true")); @@ -769,11 +761,11 @@ public void testSetPriority() throws Exception { createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0).put(IndexMetadata.INDEX_PRIORITY_SETTING.getKey(), 100)); int priority = randomIntBetween(0, 99); - createNewSingletonPolicy(client(), policy, "warm", new SetPriorityAction(priority)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "warm", new SetPriorityAction(priority)); updatePolicy(index, policy); assertBusy(() -> { - Map settings = getOnlyIndexSettings(client(), index); - assertThat(getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("warm").getKey())); + Map settings = TimeSeriesRestDriver.getOnlyIndexSettings(client(), index); + assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("warm").getKey())); assertThat(settings.get(IndexMetadata.INDEX_PRIORITY_SETTING.getKey()), equalTo(String.valueOf(priority))); }); } @@ -781,11 +773,11 @@ public void testSetPriority() throws Exception { public void testSetNullPriority() throws Exception { createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0).put(IndexMetadata.INDEX_PRIORITY_SETTING.getKey(), 100)); - createNewSingletonPolicy(client(), policy, "warm", new SetPriorityAction((Integer) null)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "warm", new SetPriorityAction((Integer) null)); updatePolicy(index, policy); assertBusy(() -> { - Map settings = getOnlyIndexSettings(client(), index); - assertThat(getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("warm").getKey())); + Map settings = TimeSeriesRestDriver.getOnlyIndexSettings(client(), index); + assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("warm").getKey())); assertNull(settings.get(IndexMetadata.INDEX_PRIORITY_SETTING.getKey())); }); } @@ -809,7 +801,7 @@ public void testNonexistentPolicy() throws Exception { client().performRequest(templateRequest); policy = randomAlphaOfLengthBetween(5,20); - createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); index = indexPrefix + "-000001"; final StringEntity putIndex = new StringEntity("{\n" + @@ -822,7 +814,7 @@ public void testNonexistentPolicy() throws Exception { Request putIndexRequest = new Request("PUT", index); putIndexRequest.setEntity(putIndex); client().performRequest(putIndexRequest); - indexDocument(client(), index); + TimeSeriesRestDriver.indexDocument(client(), index); assertBusy(() -> { Request explainRequest = new Request("GET", index + "/_ilm/explain"); @@ -847,19 +839,19 @@ public void testInvalidPolicyNames() { ResponseException ex; policy = randomAlphaOfLengthBetween(0,10) + "," + randomAlphaOfLengthBetween(0,10); - ex = expectThrows(ResponseException.class, () -> createNewSingletonPolicy(client(), policy, "delete", new DeleteAction())); + ex = expectThrows(ResponseException.class, () -> TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "delete", new DeleteAction())); assertThat(ex.getMessage(), containsString("invalid policy name")); policy = randomAlphaOfLengthBetween(0,10) + "%20" + randomAlphaOfLengthBetween(0,10); - ex = expectThrows(ResponseException.class, () -> createNewSingletonPolicy(client(), policy, "delete", new DeleteAction())); + ex = expectThrows(ResponseException.class, () -> TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "delete", new DeleteAction())); assertThat(ex.getMessage(), containsString("invalid policy name")); policy = "_" + randomAlphaOfLengthBetween(1, 20); - ex = expectThrows(ResponseException.class, () -> createNewSingletonPolicy(client(), policy, "delete", new DeleteAction())); + ex = expectThrows(ResponseException.class, () -> TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "delete", new DeleteAction())); assertThat(ex.getMessage(), containsString("invalid policy name")); policy = randomAlphaOfLengthBetween(256, 1000); - ex = expectThrows(ResponseException.class, () -> createNewSingletonPolicy(client(), policy, "delete", new DeleteAction())); + ex = expectThrows(ResponseException.class, () -> TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "delete", new DeleteAction())); assertThat(ex.getMessage(), containsString("invalid policy name")); } @@ -869,11 +861,11 @@ public void testDeletePolicyInUse() throws IOException { String unmanagedIndex = randomAlphaOfLength(9).toLowerCase(Locale.ROOT); String managedByOtherPolicyIndex = randomAlphaOfLength(10).toLowerCase(Locale.ROOT); - createNewSingletonPolicy(client(), policy, "delete", new DeleteAction(), TimeValue.timeValueHours(12)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "delete", new DeleteAction(), TimeValue.timeValueHours(12)); String originalPolicy = policy; String otherPolicy = randomValueOtherThan(policy, () -> randomAlphaOfLength(5)); policy = otherPolicy; - createNewSingletonPolicy(client(), policy, "delete", new DeleteAction(), TimeValue.timeValueHours(13)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "delete", new DeleteAction(), TimeValue.timeValueHours(13)); createIndexWithSettingsNoAlias(managedIndex1, Settings.builder() .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, randomIntBetween(1,10)) @@ -902,7 +894,7 @@ public void testRemoveAndReaddPolicy() throws Exception { String originalIndex = index + "-000001"; String secondIndex = index + "-000002"; // Set up a policy with rollover - createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); createIndexWithSettings( originalIndex, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) @@ -930,22 +922,22 @@ public void testRemoveAndReaddPolicy() throws Exception { " }\n" + "}"); client().performRequest(addPolicyRequest); - assertBusy(() -> assertTrue((boolean) explainIndex(client(), originalIndex).getOrDefault("managed", false))); + assertBusy(() -> assertTrue((boolean) TimeSeriesRestDriver.explainIndex(client(), originalIndex).getOrDefault("managed", false))); // Wait for everything to be copacetic - assertBusy(() -> assertThat(getStepKeyForIndex(client(), originalIndex), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); + assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), originalIndex), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); } public void testMoveToInjectedStep() throws Exception { String shrunkenIndex = ShrinkAction.SHRUNKEN_INDEX_PREFIX + index; - createNewSingletonPolicy(client(), policy, "warm", new ShrinkAction(1), TimeValue.timeValueHours(12)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "warm", new ShrinkAction(1), TimeValue.timeValueHours(12)); createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 3) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) .put(LifecycleSettings.LIFECYCLE_NAME, policy) .put(RolloverAction.LIFECYCLE_ROLLOVER_ALIAS, alias)); - assertBusy(() -> assertThat(getStepKeyForIndex(client(), index), equalTo(new StepKey("new", "complete", "complete")))); + assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index), equalTo(new StepKey("new", "complete", "complete")))); // Move to a step from the injected unfollow action Request moveToStepRequest = new Request("POST", "_ilm/move/" + index); @@ -968,13 +960,13 @@ public void testMoveToInjectedStep() throws Exception { assertBusy(() -> { assertTrue(indexExists(shrunkenIndex)); assertTrue(aliasExists(shrunkenIndex, index)); - assertThat(getStepKeyForIndex(client(), shrunkenIndex), equalTo(PhaseCompleteStep.finalStep("warm").getKey())); + assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), shrunkenIndex), equalTo(PhaseCompleteStep.finalStep("warm").getKey())); }, 30, TimeUnit.SECONDS); } @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/53612") public void testMoveToStepRereadsPolicy() throws Exception { - createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, TimeValue.timeValueHours(1), null), TimeValue.ZERO); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, TimeValue.timeValueHours(1), null), TimeValue.ZERO); createIndexWithSettings("test-1", Settings.builder() .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) @@ -983,10 +975,10 @@ public void testMoveToStepRereadsPolicy() throws Exception { .put(RolloverAction.LIFECYCLE_ROLLOVER_ALIAS, alias), true); - assertBusy(() -> assertThat(getStepKeyForIndex(client(), "test-1"), + assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), "test-1"), equalTo(new StepKey("hot", "rollover", "check-rollover-ready")))); - createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, TimeValue.timeValueSeconds(1), null), TimeValue.ZERO); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, TimeValue.timeValueSeconds(1), null), TimeValue.ZERO); // Move to the same step, which should re-read the policy Request moveToStepRequest = new Request("POST", "_ilm/move/test-1"); @@ -1038,7 +1030,7 @@ public void testExplainFilters() throws Exception { String nonexistantPolicyIndex = index + "-nonexistant-policy"; String unmanagedIndex = index + "-unmanaged"; - createFullPolicy(client(), policy, TimeValue.ZERO); + TimeSeriesRestDriver.createFullPolicy(client(), policy, TimeValue.ZERO); { // Create a "shrink-only-policy" @@ -1073,17 +1065,17 @@ public void testExplainFilters() throws Exception { .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)); assertBusy(() -> { - Map> explainResponse = explain(client(), index + "*", false, false); + Map> explainResponse = TimeSeriesRestDriver.explain(client(), index + "*", false, false); assertNotNull(explainResponse); assertThat(explainResponse, allOf(hasKey(goodIndex), hasKey(errorIndex), hasKey(nonexistantPolicyIndex), hasKey(unmanagedIndex))); - Map> onlyManagedResponse = explain(client(), index + "*", false, true); + Map> onlyManagedResponse = TimeSeriesRestDriver.explain(client(), index + "*", false, true); assertNotNull(onlyManagedResponse); assertThat(onlyManagedResponse, allOf(hasKey(goodIndex), hasKey(errorIndex), hasKey(nonexistantPolicyIndex))); assertThat(onlyManagedResponse, not(hasKey(unmanagedIndex))); - Map> onlyErrorsResponse = explain(client(), index + "*", true, true); + Map> onlyErrorsResponse = TimeSeriesRestDriver.explain(client(), index + "*", true, true); assertNotNull(onlyErrorsResponse); assertThat(onlyErrorsResponse, allOf(hasKey(errorIndex), hasKey(nonexistantPolicyIndex))); assertThat(onlyErrorsResponse, allOf(not(hasKey(goodIndex)), not(hasKey(unmanagedIndex)))); @@ -1091,7 +1083,7 @@ public void testExplainFilters() throws Exception { } public void testExplainIndexContainsAutomaticRetriesInformation() throws Exception { - createFullPolicy(client(), policy, TimeValue.ZERO); + TimeSeriesRestDriver.createFullPolicy(client(), policy, TimeValue.ZERO); // create index without alias so the rollover action fails and is retried createIndexWithSettingsNoAlias(index, Settings.builder() @@ -1100,7 +1092,7 @@ public void testExplainIndexContainsAutomaticRetriesInformation() throws Excepti ); assertBusy(() -> { - Map explainIndex = explainIndex(client(), index); + Map explainIndex = TimeSeriesRestDriver.explainIndex(client(), index); assertThat((Integer) explainIndex.get(FAILED_STEP_RETRY_COUNT_FIELD), greaterThanOrEqualTo(1)); assertThat(explainIndex.get(IS_AUTO_RETRYABLE_ERROR_FIELD), is(true)); }); @@ -1109,7 +1101,7 @@ public void testExplainIndexContainsAutomaticRetriesInformation() throws Excepti public void testILMRolloverRetriesOnReadOnlyBlock() throws Exception { String firstIndex = index + "-000001"; - createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, TimeValue.timeValueSeconds(1), null)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, TimeValue.timeValueSeconds(1), null)); // create the index as readonly and associate the ILM policy to it createIndexWithSettings( @@ -1123,7 +1115,7 @@ public void testILMRolloverRetriesOnReadOnlyBlock() throws Exception { ); // wait for ILM to start retrying the step - assertBusy(() -> assertThat((Integer) explainIndex(client(), firstIndex).get(FAILED_STEP_RETRY_COUNT_FIELD), + assertBusy(() -> assertThat((Integer) TimeSeriesRestDriver.explainIndex(client(), firstIndex).get(FAILED_STEP_RETRY_COUNT_FIELD), greaterThanOrEqualTo(1))); // remove the read only block @@ -1136,7 +1128,7 @@ public void testILMRolloverRetriesOnReadOnlyBlock() throws Exception { client().performRequest(allowWritesOnIndexSettingUpdate); // index is not readonly so the ILM should complete successfully - assertBusy(() -> assertThat(getStepKeyForIndex(client(), firstIndex), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); + assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), firstIndex), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); } public void testILMRolloverOnManuallyRolledIndex() throws Exception { @@ -1145,7 +1137,7 @@ public void testILMRolloverOnManuallyRolledIndex() throws Exception { String thirdIndex = index + "-000003"; // Set up a policy with rollover - createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 2L)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 2L)); Request createIndexTemplate = new Request("PUT", "_template/rolling_indexes"); createIndexTemplate.setJsonEntity("{" + "\"index_patterns\": [\"" + index + "-*\"], \n" + @@ -1171,7 +1163,7 @@ public void testILMRolloverOnManuallyRolledIndex() throws Exception { client().performRequest(refreshOriginalIndex); // Manual rollover - rolloverMaxOneDocCondition(client(), alias); + TimeSeriesRestDriver.rolloverMaxOneDocCondition(client(), alias); assertBusy(() -> assertTrue(indexExists(secondIndex))); // Index another document into the original index so the ILM rollover policy condition is met @@ -1179,10 +1171,10 @@ public void testILMRolloverOnManuallyRolledIndex() throws Exception { client().performRequest(refreshOriginalIndex); // Wait for the rollover policy to execute - assertBusy(() -> assertThat(getStepKeyForIndex(client(), originalIndex), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); + assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), originalIndex), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); // ILM should manage the second index after attempting (and skipping) rolling the original index - assertBusy(() -> assertTrue((boolean) explainIndex(client(), secondIndex).getOrDefault("managed", true))); + assertBusy(() -> assertTrue((boolean) TimeSeriesRestDriver.explainIndex(client(), secondIndex).getOrDefault("managed", true))); // index some documents to trigger an ILM rollover index(client(), alias, "1", "foo", "bar"); @@ -1192,7 +1184,7 @@ public void testILMRolloverOnManuallyRolledIndex() throws Exception { client().performRequest(refreshSecondIndex).getStatusLine(); // ILM should rollover the second index even though it skipped the first one - assertBusy(() -> assertThat(getStepKeyForIndex(client(), secondIndex), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); + assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), secondIndex), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); assertBusy(() -> assertTrue(indexExists(thirdIndex))); } @@ -1200,7 +1192,7 @@ public void testRolloverStepRetriesUntilRolledOverIndexIsDeleted() throws Except String index = this.index + "-000001"; String rolledIndex = this.index + "-000002"; - createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, TimeValue.timeValueSeconds(1), null)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, TimeValue.timeValueSeconds(1), null)); // create the rolled index so the rollover of the first index fails createIndexWithSettings( @@ -1220,7 +1212,7 @@ public void testRolloverStepRetriesUntilRolledOverIndexIsDeleted() throws Except true ); - assertBusy(() -> assertThat((Integer) explainIndex(client(), index).get(FAILED_STEP_RETRY_COUNT_FIELD), greaterThanOrEqualTo(1)), + assertBusy(() -> assertThat((Integer) TimeSeriesRestDriver.explainIndex(client(), index).get(FAILED_STEP_RETRY_COUNT_FIELD), greaterThanOrEqualTo(1)), 30, TimeUnit.SECONDS); @@ -1254,7 +1246,7 @@ public void testRolloverStepRetriesUntilRolledOverIndexIsDeleted() throws Except // retried (which means ILM moves back and forth between the `attempt-rollover` step and the `error` step) assertTrue("ILM did not start retrying the attempt-rollover step", waitUntil(() -> { try { - Map explainIndexResponse = explainIndex(client(), index); + Map explainIndexResponse = TimeSeriesRestDriver.explainIndex(client(), index); String failedStep = (String) explainIndexResponse.get("failed_step"); Integer retryCount = (Integer) explainIndexResponse.get(FAILED_STEP_RETRY_COUNT_FIELD); return failedStep != null && failedStep.equals("attempt-rollover") && retryCount != null && retryCount >= 1; @@ -1267,13 +1259,13 @@ public void testRolloverStepRetriesUntilRolledOverIndexIsDeleted() throws Except // the rollover step should eventually succeed assertBusy(() -> assertThat(indexExists(rolledIndex), is(true))); - assertBusy(() -> assertThat(getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); + assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); } public void testUpdateRolloverLifecycleDateStepRetriesWhenRolloverInfoIsMissing() throws Exception { String index = this.index + "-000001"; - createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); createIndexWithSettings( index, @@ -1284,7 +1276,7 @@ public void testUpdateRolloverLifecycleDateStepRetriesWhenRolloverInfoIsMissing( true ); - assertBusy(() -> assertThat(getStepKeyForIndex(client(), index).getName(), is(WaitForRolloverReadyStep.NAME))); + assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index).getName(), Matchers.is(WaitForRolloverReadyStep.NAME))); // moving ILM to the "update-rollover-lifecycle-date" without having gone through the actual rollover step // the "update-rollover-lifecycle-date" step will fail as the index has no rollover information @@ -1305,7 +1297,7 @@ public void testUpdateRolloverLifecycleDateStepRetriesWhenRolloverInfoIsMissing( assertTrue("ILM did not start retrying the update-rollover-lifecycle-date step", waitUntil(() -> { try { - Map explainIndexResponse = explainIndex(client(), index); + Map explainIndexResponse = TimeSeriesRestDriver.explainIndex(client(), index); String failedStep = (String) explainIndexResponse.get("failed_step"); Integer retryCount = (Integer) explainIndexResponse.get(FAILED_STEP_RETRY_COUNT_FIELD); return failedStep != null && failedStep.equals(UpdateRolloverLifecycleDateStep.NAME) && retryCount != null @@ -1321,8 +1313,8 @@ public void testUpdateRolloverLifecycleDateStepRetriesWhenRolloverInfoIsMissing( // manual rollover the index so the "update-rollover-lifecycle-date" ILM step can continue and finish successfully as the index // will have rollover information now - rolloverMaxOneDocCondition(client(), alias); - assertBusy(() -> assertThat(getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); + TimeSeriesRestDriver.rolloverMaxOneDocCondition(client(), alias); + assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); } public void testWaitForActiveShardsStep() throws Exception { @@ -1334,7 +1326,7 @@ public void testWaitForActiveShardsStep() throws Exception { true); // create policy - createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); // update policy on index updatePolicy(originalIndex, policy); Request createIndexTemplate = new Request("PUT", "_template/rolling_indexes"); @@ -1352,17 +1344,17 @@ public void testWaitForActiveShardsStep() throws Exception { index(client(), originalIndex, "_id", "foo", "bar"); assertBusy(() -> assertTrue(indexExists(secondIndex))); - assertBusy(() -> assertThat(getStepKeyForIndex(client(), originalIndex).getName(), equalTo(WaitForActiveShardsStep.NAME))); + assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), originalIndex).getName(), equalTo(WaitForActiveShardsStep.NAME))); // reset the number of replicas to 0 so that the second index wait for active shard condition can be met updateIndexSettings(secondIndex, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)); - assertBusy(() -> assertThat(getStepKeyForIndex(client(), originalIndex), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); + assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), originalIndex), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); } @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/54093") public void testHistoryIsWrittenWithSuccess() throws Exception { - createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); Request createIndexTemplate = new Request("PUT", "_template/rolling_indexes"); createIndexTemplate.setJsonEntity("{" + "\"index_patterns\": [\""+ index + "-*\"], \n" + @@ -1382,7 +1374,7 @@ public void testHistoryIsWrittenWithSuccess() throws Exception { Request refreshIndex = new Request("POST", "/" + index + "-1/_refresh"); client().performRequest(refreshIndex); - assertBusy(() -> assertThat(getStepKeyForIndex(client(), index + "-1"), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); + assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index + "-1"), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); assertBusy(() -> assertHistoryIsPresent(policy, index + "-1", true, "wait-for-indexing-complete"), 30, TimeUnit.SECONDS); assertBusy(() -> assertHistoryIsPresent(policy, index + "-1", true, "wait-for-follow-shard-tasks"), 30, TimeUnit.SECONDS); @@ -1402,7 +1394,7 @@ public void testHistoryIsWrittenWithSuccess() throws Exception { @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/50353") public void testHistoryIsWrittenWithFailure() throws Exception { createIndexWithSettings(index + "-1", Settings.builder(), false); - createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); updatePolicy(index + "-1", policy); // Index a document @@ -1411,7 +1403,7 @@ public void testHistoryIsWrittenWithFailure() throws Exception { client().performRequest(refreshIndex); // Check that we've had error and auto retried - assertBusy(() -> assertThat((Integer) explainIndex(client(), index + "-1").get("failed_step_retry_count"), + assertBusy(() -> assertThat((Integer) TimeSeriesRestDriver.explainIndex(client(), index + "-1").get("failed_step_retry_count"), greaterThanOrEqualTo(1))); assertBusy(() -> assertHistoryIsPresent(policy, index + "-1", false, "ERROR"), 30, TimeUnit.SECONDS); @@ -1421,7 +1413,7 @@ public void testHistoryIsWrittenWithFailure() throws Exception { public void testHistoryIsWrittenWithDeletion() throws Exception { // Index should be created and then deleted by ILM createIndexWithSettings(index, Settings.builder(), false); - createNewSingletonPolicy(client(), policy, "delete", new DeleteAction()); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "delete", new DeleteAction()); updatePolicy(index, policy); assertBusy(() -> assertFalse(indexExists(index))); @@ -1437,7 +1429,7 @@ public void testRetryableInitializationStep() throws Exception { Request stopReq = new Request("POST", "/_ilm/stop"); Request startReq = new Request("POST", "/_ilm/start"); - createNewSingletonPolicy(client(), policy, "hot", new SetPriorityAction(1)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new SetPriorityAction(1)); // Stop ILM so that the initialize step doesn't run assertOK(client().performRequest(stopReq)); @@ -1458,7 +1450,7 @@ public void testRetryableInitializationStep() throws Exception { // Wait until an error has occurred. assertTrue("ILM did not start retrying the init step", waitUntil(() -> { try { - Map explainIndexResponse = explainIndex(client(), index); + Map explainIndexResponse = TimeSeriesRestDriver.explainIndex(client(), index); String failedStep = (String) explainIndexResponse.get("failed_step"); Integer retryCount = (Integer) explainIndexResponse.get(FAILED_STEP_RETRY_COUNT_FIELD); return failedStep != null && failedStep.equals(InitializePolicyContextStep.KEY.getAction()) && retryCount != null @@ -1473,7 +1465,7 @@ public void testRetryableInitializationStep() throws Exception { .put(LifecycleSettings.LIFECYCLE_PARSE_ORIGINATION_DATE, false)); assertBusy(() -> { - Map explainResp = explainIndex(client(), index); + Map explainResp = TimeSeriesRestDriver.explainIndex(client(), index); String phase = (String) explainResp.get("phase"); assertThat(phase, equalTo("hot")); }); @@ -1482,7 +1474,7 @@ public void testRetryableInitializationStep() throws Exception { public void testRefreshablePhaseJson() throws Exception { String index = "refresh-index"; - createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 100L)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 100L)); Request createIndexTemplate = new Request("PUT", "_template/rolling_indexes"); createIndexTemplate.setJsonEntity("{" + "\"index_patterns\": [\""+ index + "-*\"], \n" + @@ -1504,20 +1496,20 @@ public void testRefreshablePhaseJson() throws Exception { index(client(), index + "-1", "1", "foo", "bar"); // Wait for the index to enter the check-rollover-ready step - assertBusy(() -> assertThat(getStepKeyForIndex(client(), index + "-1").getName(), equalTo(WaitForRolloverReadyStep.NAME))); + assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index + "-1").getName(), equalTo(WaitForRolloverReadyStep.NAME))); // Update the policy to allow rollover at 1 document instead of 100 - createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); // Index should now have been able to roll over, creating the new index and proceeding to the "complete" step assertBusy(() -> assertThat(indexExists(index + "-000002"), is(true))); - assertBusy(() -> assertThat(getStepKeyForIndex(client(), index + "-1").getName(), equalTo(PhaseCompleteStep.NAME))); + assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index + "-1").getName(), equalTo(PhaseCompleteStep.NAME))); } public void testHaltAtEndOfPhase() throws Exception { String index = "halt-index"; - createNewSingletonPolicy(client(), policy, "hot", new SetPriorityAction(100)); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new SetPriorityAction(100)); createIndexWithSettings(index, Settings.builder() @@ -1527,7 +1519,7 @@ public void testHaltAtEndOfPhase() throws Exception { randomBoolean()); // Wait for the index to finish the "hot" phase - assertBusy(() -> assertThat(getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); + assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); // Update the policy to add a delete phase { @@ -1553,8 +1545,8 @@ public void testHaltAtEndOfPhase() throws Exception { public void testSearchableSnapshotAction() throws Exception { String snapshotRepo = randomAlphaOfLengthBetween(4, 10); - createSnapshotRepo(client(), snapshotRepo, randomBoolean()); - createNewSingletonPolicy(client(), policy, "cold", new SearchableSnapshotAction(snapshotRepo)); + TimeSeriesRestDriver.createSnapshotRepo(client(), snapshotRepo, randomBoolean()); + TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "cold", new SearchableSnapshotAction(snapshotRepo)); createIndexWithSettings(index, Settings.builder() @@ -1572,14 +1564,14 @@ public void testSearchableSnapshotAction() throws Exception { } }, 30, TimeUnit.SECONDS)); - assertBusy(() -> assertThat(explainIndex(client(), restoredIndexName).get("step"), is(PhaseCompleteStep.NAME)), 30, + assertBusy(() -> assertThat(TimeSeriesRestDriver.explainIndex(client(), restoredIndexName).get("step"), Matchers.is(PhaseCompleteStep.NAME)), 30, TimeUnit.SECONDS); } @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/pull/54433") public void testDeleteActionDeletesSearchableSnapshot() throws Exception { String snapshotRepo = randomAlphaOfLengthBetween(4, 10); - createSnapshotRepo(client(), snapshotRepo, randomBoolean()); + TimeSeriesRestDriver.createSnapshotRepo(client(), snapshotRepo, randomBoolean()); // create policy with cold and delete phases Map coldActions = @@ -1609,10 +1601,10 @@ public void testDeleteActionDeletesSearchableSnapshot() throws Exception { String restoredIndexName = SearchableSnapshotAction.RESTORED_INDEX_PREFIX + this.index; assertTrue(waitUntil(() -> { try { - Map explainIndex = explainIndex(client(), index); + Map explainIndex = TimeSeriesRestDriver.explainIndex(client(), index); if(explainIndex == null) { // in case we missed the original index and it was deleted - explainIndex = explainIndex(client(), restoredIndexName); + explainIndex = TimeSeriesRestDriver.explainIndex(client(), restoredIndexName); } snapshotName[0] = (String) explainIndex.get("snapshot_name"); return snapshotName[0] != null; @@ -1636,7 +1628,7 @@ public void testDeleteActionDeletesSearchableSnapshot() throws Exception { @SuppressWarnings("unchecked") public void testDeleteActionDoesntDeleteSearchableSnapshot() throws Exception { String snapshotRepo = randomAlphaOfLengthBetween(4, 10); - createSnapshotRepo(client(), snapshotRepo, randomBoolean()); + TimeSeriesRestDriver.createSnapshotRepo(client(), snapshotRepo, randomBoolean()); // create policy with cold and delete phases Map coldActions = @@ -1666,10 +1658,10 @@ public void testDeleteActionDoesntDeleteSearchableSnapshot() throws Exception { String restoredIndexName = SearchableSnapshotAction.RESTORED_INDEX_PREFIX + this.index; assertTrue(waitUntil(() -> { try { - Map explainIndex = explainIndex(client(), index); + Map explainIndex = TimeSeriesRestDriver.explainIndex(client(), index); if(explainIndex == null) { // in case we missed the original index and it was deleted - explainIndex = explainIndex(client(), restoredIndexName); + explainIndex = TimeSeriesRestDriver.explainIndex(client(), restoredIndexName); } snapshotName[0] = (String) explainIndex.get("snapshot_name"); return snapshotName[0] != null; @@ -1797,7 +1789,7 @@ private void assertHistoryIsPresent(String policyName, String indexName, boolean } // Finally, check that the history index is in a good state - Step.StepKey stepKey = getStepKeyForIndex(client(), "ilm-history-2-000001"); + Step.StepKey stepKey = TimeSeriesRestDriver.getStepKeyForIndex(client(), "ilm-history-2-000001"); assertEquals("hot", stepKey.getPhase()); assertEquals(RolloverAction.NAME, stepKey.getAction()); assertEquals(WaitForRolloverReadyStep.NAME, stepKey.getName()); @@ -1843,7 +1835,7 @@ private static void index(RestClient client, String index, String id, Object... @Nullable private String getFailedStepForIndex(String indexName) throws IOException { - Map indexResponse = explainIndex(client(), indexName); + Map indexResponse = TimeSeriesRestDriver.explainIndex(client(), indexName); if (indexResponse == null) { return null; } @@ -1894,7 +1886,7 @@ private void assertBusy(CheckedRunnable runnable, String slmPolicy) t } catch (Exception ignored) { slm = new HashMap<>(); } - throw new AssertionError("Index:" + explainIndex(client(), index) + "\nSLM:" + slm, e); + throw new AssertionError("Index:" + TimeSeriesRestDriver.explainIndex(client(), index) + "\nSLM:" + slm, e); } }); } diff --git a/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/slm/SnapshotLifecycleRestIT.java b/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/slm/SnapshotLifecycleRestIT.java similarity index 100% rename from x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/slm/SnapshotLifecycleRestIT.java rename to x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/slm/SnapshotLifecycleRestIT.java diff --git a/x-pack/plugin/ilm/qa/rest/build.gradle b/x-pack/plugin/ilm/qa/rest/build.gradle index c6abe89dcb180..4e7116e1eef10 100644 --- a/x-pack/plugin/ilm/qa/rest/build.gradle +++ b/x-pack/plugin/ilm/qa/rest/build.gradle @@ -1,12 +1,7 @@ -import org.elasticsearch.gradle.test.RestIntegTestTask - -apply plugin: 'elasticsearch.testclusters' -apply plugin: 'elasticsearch.standalone-test' -apply plugin: 'elasticsearch.rest-resources' +apply plugin: 'elasticsearch.yaml-rest-test' dependencies { - testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts') - testImplementation project(path: xpackModule('ilm')) + yamlRestTestImplementation project(path: xpackModule('core'), configuration: 'testArtifacts') } restResources { @@ -19,19 +14,15 @@ restResources { def clusterCredentials = [username: System.getProperty('tests.rest.cluster.username', 'test_admin'), password: System.getProperty('tests.rest.cluster.password', 'x-pack-test-password')] -task restTest(type: RestIntegTestTask) { - mustRunAfter(precommit) +yamlRestTest { systemProperty 'tests.rest.cluster.username', clusterCredentials.username systemProperty 'tests.rest.cluster.password', clusterCredentials.password } -testClusters.restTest { +testClusters.all { testDistribution = 'DEFAULT' setting 'xpack.ml.enabled', 'false' setting 'xpack.security.enabled', 'true' setting 'xpack.license.self_generated.type', 'trial' user clusterCredentials } - -check.dependsOn restTest -test.enabled = false diff --git a/x-pack/plugin/ilm/qa/rest/src/test/java/org/elasticsearch/xpack/ilm/IndexLifecycleRestIT.java b/x-pack/plugin/ilm/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/ilm/IndexLifecycleRestIT.java similarity index 96% rename from x-pack/plugin/ilm/qa/rest/src/test/java/org/elasticsearch/xpack/ilm/IndexLifecycleRestIT.java rename to x-pack/plugin/ilm/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/ilm/IndexLifecycleRestIT.java index bc753540c9e91..4db5e35eda118 100644 --- a/x-pack/plugin/ilm/qa/rest/src/test/java/org/elasticsearch/xpack/ilm/IndexLifecycleRestIT.java +++ b/x-pack/plugin/ilm/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/ilm/IndexLifecycleRestIT.java @@ -32,7 +32,7 @@ public IndexLifecycleRestIT(@Name("yaml") ClientYamlTestCandidate testCandidate) @ParametersFactory public static Iterable parameters() throws Exception { - return ESClientYamlSuiteTestCase.createParameters(); + return createParameters(); } @Override diff --git a/x-pack/plugin/ilm/qa/rest/src/test/resources/rest-api-spec/test/ilm/10_basic.yml b/x-pack/plugin/ilm/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ilm/10_basic.yml similarity index 100% rename from x-pack/plugin/ilm/qa/rest/src/test/resources/rest-api-spec/test/ilm/10_basic.yml rename to x-pack/plugin/ilm/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ilm/10_basic.yml diff --git a/x-pack/plugin/ilm/qa/rest/src/test/resources/rest-api-spec/test/ilm/11_basic_slm.yml b/x-pack/plugin/ilm/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ilm/11_basic_slm.yml similarity index 100% rename from x-pack/plugin/ilm/qa/rest/src/test/resources/rest-api-spec/test/ilm/11_basic_slm.yml rename to x-pack/plugin/ilm/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ilm/11_basic_slm.yml diff --git a/x-pack/plugin/ilm/qa/rest/src/test/resources/rest-api-spec/test/ilm/20_move_to_step.yml b/x-pack/plugin/ilm/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ilm/20_move_to_step.yml similarity index 100% rename from x-pack/plugin/ilm/qa/rest/src/test/resources/rest-api-spec/test/ilm/20_move_to_step.yml rename to x-pack/plugin/ilm/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ilm/20_move_to_step.yml diff --git a/x-pack/plugin/ilm/qa/rest/src/test/resources/rest-api-spec/test/ilm/30_retry.yml b/x-pack/plugin/ilm/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ilm/30_retry.yml similarity index 100% rename from x-pack/plugin/ilm/qa/rest/src/test/resources/rest-api-spec/test/ilm/30_retry.yml rename to x-pack/plugin/ilm/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ilm/30_retry.yml diff --git a/x-pack/plugin/ilm/qa/rest/src/test/resources/rest-api-spec/test/ilm/40_explain_lifecycle.yml b/x-pack/plugin/ilm/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ilm/40_explain_lifecycle.yml similarity index 100% rename from x-pack/plugin/ilm/qa/rest/src/test/resources/rest-api-spec/test/ilm/40_explain_lifecycle.yml rename to x-pack/plugin/ilm/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ilm/40_explain_lifecycle.yml diff --git a/x-pack/plugin/ilm/qa/rest/src/test/resources/rest-api-spec/test/ilm/60_operation_mode.yml b/x-pack/plugin/ilm/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ilm/60_operation_mode.yml similarity index 100% rename from x-pack/plugin/ilm/qa/rest/src/test/resources/rest-api-spec/test/ilm/60_operation_mode.yml rename to x-pack/plugin/ilm/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ilm/60_operation_mode.yml diff --git a/x-pack/plugin/ilm/qa/rest/src/test/resources/rest-api-spec/test/ilm/60_remove_policy_for_index.yml b/x-pack/plugin/ilm/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ilm/60_remove_policy_for_index.yml similarity index 100% rename from x-pack/plugin/ilm/qa/rest/src/test/resources/rest-api-spec/test/ilm/60_remove_policy_for_index.yml rename to x-pack/plugin/ilm/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ilm/60_remove_policy_for_index.yml diff --git a/x-pack/plugin/ilm/qa/with-security/build.gradle b/x-pack/plugin/ilm/qa/with-security/build.gradle index f7e3010087f7c..20e94a00ea6c2 100644 --- a/x-pack/plugin/ilm/qa/with-security/build.gradle +++ b/x-pack/plugin/ilm/qa/with-security/build.gradle @@ -1,20 +1,18 @@ -apply plugin: 'elasticsearch.testclusters' -apply plugin: 'elasticsearch.standalone-rest-test' -apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.java-rest-test' dependencies { - testImplementation project(path: xpackProject('plugin').path, configuration: 'testArtifacts') + javaRestTestImplementation project(path: xpackProject('plugin').path, configuration: 'testArtifacts') } def clusterCredentials = [username: System.getProperty('tests.rest.cluster.username', 'test_admin'), password: System.getProperty('tests.rest.cluster.password', 'x-pack-test-password')] -integTest { +javaRestTest { systemProperty 'tests.rest.cluster.username', clusterCredentials.username systemProperty 'tests.rest.cluster.password', clusterCredentials.password } -testClusters.integTest { +testClusters.all { testDistribution = 'DEFAULT' setting 'xpack.security.enabled', 'true' setting 'xpack.watcher.enabled', 'false' diff --git a/x-pack/plugin/ilm/qa/with-security/src/test/java/org/elasticsearch/xpack/security/PermissionsIT.java b/x-pack/plugin/ilm/qa/with-security/src/javaRestTest/java/org/elasticsearch/xpack/security/PermissionsIT.java similarity index 100% rename from x-pack/plugin/ilm/qa/with-security/src/test/java/org/elasticsearch/xpack/security/PermissionsIT.java rename to x-pack/plugin/ilm/qa/with-security/src/javaRestTest/java/org/elasticsearch/xpack/security/PermissionsIT.java diff --git a/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/IndexLifecycleInitialisationTests.java b/x-pack/plugin/ilm/src/internalClusterTest/java/org/elasticsearch/xpack/ilm/IndexLifecycleInitialisationTests.java similarity index 100% rename from x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/IndexLifecycleInitialisationTests.java rename to x-pack/plugin/ilm/src/internalClusterTest/java/org/elasticsearch/xpack/ilm/IndexLifecycleInitialisationTests.java diff --git a/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/UpdateSettingsStepTests.java b/x-pack/plugin/ilm/src/internalClusterTest/java/org/elasticsearch/xpack/ilm/UpdateSettingsStepTests.java similarity index 100% rename from x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/UpdateSettingsStepTests.java rename to x-pack/plugin/ilm/src/internalClusterTest/java/org/elasticsearch/xpack/ilm/UpdateSettingsStepTests.java diff --git a/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/slm/SLMSnapshotBlockingIntegTests.java b/x-pack/plugin/ilm/src/internalClusterTest/java/org/elasticsearch/xpack/slm/SLMSnapshotBlockingIntegTests.java similarity index 100% rename from x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/slm/SLMSnapshotBlockingIntegTests.java rename to x-pack/plugin/ilm/src/internalClusterTest/java/org/elasticsearch/xpack/slm/SLMSnapshotBlockingIntegTests.java diff --git a/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/slm/SnapshotLifecycleInitialisationTests.java b/x-pack/plugin/ilm/src/internalClusterTest/java/org/elasticsearch/xpack/slm/SnapshotLifecycleInitialisationTests.java similarity index 100% rename from x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/slm/SnapshotLifecycleInitialisationTests.java rename to x-pack/plugin/ilm/src/internalClusterTest/java/org/elasticsearch/xpack/slm/SnapshotLifecycleInitialisationTests.java From 3f43102fd98b11514df7e30901584751839a2a0f Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Wed, 5 Aug 2020 12:34:03 -0500 Subject: [PATCH 16/25] mapper-constant-keyword --- x-pack/plugin/mapper-constant-keyword/build.gradle | 3 ++- .../mapper/ConstantKeywordFieldMapperTests.java | 0 2 files changed, 2 insertions(+), 1 deletion(-) rename x-pack/plugin/mapper-constant-keyword/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/constantkeyword/mapper/ConstantKeywordFieldMapperTests.java (100%) diff --git a/x-pack/plugin/mapper-constant-keyword/build.gradle b/x-pack/plugin/mapper-constant-keyword/build.gradle index f475057056268..85109dbf0a22d 100644 --- a/x-pack/plugin/mapper-constant-keyword/build.gradle +++ b/x-pack/plugin/mapper-constant-keyword/build.gradle @@ -1,4 +1,5 @@ apply plugin: 'elasticsearch.esplugin' +apply plugin: 'elasticsearch.internal-cluster-test' esplugin { name 'constant-keyword' @@ -10,7 +11,7 @@ archivesBaseName = 'x-pack-constant-keyword' dependencies { compileOnly project(path: xpackModule('core'), configuration: 'default') - testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts') + internalClusterTestImplementation project(path: xpackModule('core'), configuration: 'testArtifacts') } integTest.enabled = false diff --git a/x-pack/plugin/mapper-constant-keyword/src/test/java/org/elasticsearch/xpack/constantkeyword/mapper/ConstantKeywordFieldMapperTests.java b/x-pack/plugin/mapper-constant-keyword/src/internalClusterTest/java/org/elasticsearch/xpack/constantkeyword/mapper/ConstantKeywordFieldMapperTests.java similarity index 100% rename from x-pack/plugin/mapper-constant-keyword/src/test/java/org/elasticsearch/xpack/constantkeyword/mapper/ConstantKeywordFieldMapperTests.java rename to x-pack/plugin/mapper-constant-keyword/src/internalClusterTest/java/org/elasticsearch/xpack/constantkeyword/mapper/ConstantKeywordFieldMapperTests.java From 78ae27d99333cf7ba8a15e3fdf0e4d0f4bb5c7ab Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Wed, 5 Aug 2020 12:49:57 -0500 Subject: [PATCH 17/25] mapper-flattened --- x-pack/plugin/mapper-flattened/build.gradle | 1 + .../xpack/flattened/mapper/FlatObjectFieldMapperTests.java | 0 .../xpack/flattened/mapper/FlatObjectIndexFieldDataTests.java | 0 .../xpack/flattened/mapper/FlatObjectSearchTests.java | 0 4 files changed, 1 insertion(+) rename x-pack/plugin/mapper-flattened/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/flattened/mapper/FlatObjectFieldMapperTests.java (100%) rename x-pack/plugin/mapper-flattened/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/flattened/mapper/FlatObjectIndexFieldDataTests.java (100%) rename x-pack/plugin/mapper-flattened/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/flattened/mapper/FlatObjectSearchTests.java (100%) diff --git a/x-pack/plugin/mapper-flattened/build.gradle b/x-pack/plugin/mapper-flattened/build.gradle index a6c9a185e90cb..46e83d5275cf0 100644 --- a/x-pack/plugin/mapper-flattened/build.gradle +++ b/x-pack/plugin/mapper-flattened/build.gradle @@ -1,4 +1,5 @@ apply plugin: 'elasticsearch.esplugin' +apply plugin: 'elasticsearch.internal-cluster-test' esplugin { name 'flattened' diff --git a/x-pack/plugin/mapper-flattened/src/test/java/org/elasticsearch/xpack/flattened/mapper/FlatObjectFieldMapperTests.java b/x-pack/plugin/mapper-flattened/src/internalClusterTest/java/org/elasticsearch/xpack/flattened/mapper/FlatObjectFieldMapperTests.java similarity index 100% rename from x-pack/plugin/mapper-flattened/src/test/java/org/elasticsearch/xpack/flattened/mapper/FlatObjectFieldMapperTests.java rename to x-pack/plugin/mapper-flattened/src/internalClusterTest/java/org/elasticsearch/xpack/flattened/mapper/FlatObjectFieldMapperTests.java diff --git a/x-pack/plugin/mapper-flattened/src/test/java/org/elasticsearch/xpack/flattened/mapper/FlatObjectIndexFieldDataTests.java b/x-pack/plugin/mapper-flattened/src/internalClusterTest/java/org/elasticsearch/xpack/flattened/mapper/FlatObjectIndexFieldDataTests.java similarity index 100% rename from x-pack/plugin/mapper-flattened/src/test/java/org/elasticsearch/xpack/flattened/mapper/FlatObjectIndexFieldDataTests.java rename to x-pack/plugin/mapper-flattened/src/internalClusterTest/java/org/elasticsearch/xpack/flattened/mapper/FlatObjectIndexFieldDataTests.java diff --git a/x-pack/plugin/mapper-flattened/src/test/java/org/elasticsearch/xpack/flattened/mapper/FlatObjectSearchTests.java b/x-pack/plugin/mapper-flattened/src/internalClusterTest/java/org/elasticsearch/xpack/flattened/mapper/FlatObjectSearchTests.java similarity index 100% rename from x-pack/plugin/mapper-flattened/src/test/java/org/elasticsearch/xpack/flattened/mapper/FlatObjectSearchTests.java rename to x-pack/plugin/mapper-flattened/src/internalClusterTest/java/org/elasticsearch/xpack/flattened/mapper/FlatObjectSearchTests.java From 61abbd28ce5ec950407633cbba2828123d3185ae Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Wed, 5 Aug 2020 15:04:30 -0500 Subject: [PATCH 18/25] ml - part 1 (not all working) --- .../ml/qa/basic-multi-node/build.gradle | 11 +---- .../ml/integration/MlBasicMultiNodeIT.java | 49 ++++++++++--------- x-pack/plugin/ml/qa/disabled/build.gradle | 14 +++--- .../ml/integration/MlPluginDisabledIT.java | 5 +- .../ml/qa/ml-with-security/build.gradle | 15 +++--- .../smoketest/MlWithSecurityIT.java | 0 .../MlWithSecurityInsufficientRoleIT.java | 0 .../smoketest/MlWithSecurityUserRoleIT.java | 0 .../qa/native-multi-node-tests/build.gradle | 33 ++++++++----- .../integration/AutodetectMemoryLimitIT.java | 0 .../integration/BasicRenormalizationIT.java | 0 .../ml/integration/BulkFailureRetryIT.java | 0 .../ml/integration/CategorizationIT.java | 0 .../ClassificationEvaluationIT.java | 0 .../ml/integration/ClassificationIT.java | 0 .../xpack/ml/integration/DatafeedJobsIT.java | 0 .../ml/integration/DatafeedWithAggsIT.java | 0 .../ml/integration/DelayedDataDetectorIT.java | 0 .../ml/integration/DeleteExpiredDataIT.java | 0 .../xpack/ml/integration/DeleteJobIT.java | 0 .../ml/integration/DetectionRulesIT.java | 0 .../ExplainDataFrameAnalyticsIT.java | 0 .../xpack/ml/integration/ForecastIT.java | 0 ...erimResultsDeletedAfterReopeningJobIT.java | 0 .../ml/integration/InterimResultsIT.java | 0 .../JobAndDatafeedResilienceIT.java | 0 .../MlDailyMaintenanceServiceIT.java | 0 .../MlNativeAutodetectIntegTestCase.java | 0 ...NativeDataFrameAnalyticsIntegTestCase.java | 0 .../ml/integration/MlNativeIntegTestCase.java | 0 .../xpack/ml/integration/ModelPlotsIT.java | 0 .../integration/ModelSnapshotRetentionIT.java | 0 .../OutlierDetectionWithMissingFieldsIT.java | 0 .../ml/integration/OverallBucketsIT.java | 0 .../xpack/ml/integration/PersistJobIT.java | 0 .../integration/RegressionEvaluationIT.java | 0 .../xpack/ml/integration/RegressionIT.java | 0 .../ml/integration/ReopenJobWithGapIT.java | 0 .../integration/RestoreModelSnapshotIT.java | 0 .../ml/integration/RevertModelSnapshotIT.java | 0 .../integration/RunDataFrameAnalyticsIT.java | 0 .../ml/integration/ScheduledEventsIT.java | 0 .../ml/integration/SetUpgradeModeIT.java | 0 ...lassificationEvaluationWithSecurityIT.java | 7 +-- .../ml/integration/DatafeedJobsRestIT.java | 7 +-- .../ml/integration/InferenceIngestIT.java | 6 ++- .../xpack/ml/integration/MlJobIT.java | 3 +- .../xpack/ml/integration/TrainedModelIT.java | 3 +- 48 files changed, 78 insertions(+), 75 deletions(-) rename x-pack/plugin/ml/qa/basic-multi-node/src/{test => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/MlBasicMultiNodeIT.java (85%) rename x-pack/plugin/ml/qa/disabled/src/{test => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/MlPluginDisabledIT.java (94%) rename x-pack/plugin/ml/qa/ml-with-security/src/{test => yamlRestTest}/java/org/elasticsearch/smoketest/MlWithSecurityIT.java (100%) rename x-pack/plugin/ml/qa/ml-with-security/src/{test => yamlRestTest}/java/org/elasticsearch/smoketest/MlWithSecurityInsufficientRoleIT.java (100%) rename x-pack/plugin/ml/qa/ml-with-security/src/{test => yamlRestTest}/java/org/elasticsearch/smoketest/MlWithSecurityUserRoleIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/AutodetectMemoryLimitIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/BasicRenormalizationIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/BulkFailureRetryIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/CategorizationIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/ClassificationEvaluationIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/ClassificationIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/DatafeedWithAggsIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/DelayedDataDetectorIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/DeleteExpiredDataIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/DeleteJobIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/DetectionRulesIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/ExplainDataFrameAnalyticsIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/ForecastIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/InterimResultsDeletedAfterReopeningJobIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/InterimResultsIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/JobAndDatafeedResilienceIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/MlDailyMaintenanceServiceIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/MlNativeAutodetectIntegTestCase.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/MlNativeDataFrameAnalyticsIntegTestCase.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/MlNativeIntegTestCase.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/ModelPlotsIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/ModelSnapshotRetentionIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/OutlierDetectionWithMissingFieldsIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/OverallBucketsIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/PersistJobIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/RegressionEvaluationIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/RegressionIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/ReopenJobWithGapIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/RestoreModelSnapshotIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/RevertModelSnapshotIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/RunDataFrameAnalyticsIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/ScheduledEventsIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => internalClusterTest}/java/org/elasticsearch/xpack/ml/integration/SetUpgradeModeIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/ClassificationEvaluationWithSecurityIT.java (89%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsRestIT.java (99%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/InferenceIngestIT.java (98%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/MlJobIT.java (99%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{test => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/TrainedModelIT.java (98%) diff --git a/x-pack/plugin/ml/qa/basic-multi-node/build.gradle b/x-pack/plugin/ml/qa/basic-multi-node/build.gradle index 074d1a4cf8a10..7e30c27d721fe 100644 --- a/x-pack/plugin/ml/qa/basic-multi-node/build.gradle +++ b/x-pack/plugin/ml/qa/basic-multi-node/build.gradle @@ -1,13 +1,6 @@ -apply plugin: 'elasticsearch.testclusters' -apply plugin: 'elasticsearch.standalone-rest-test' -apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.java-rest-test' -dependencies { - testImplementation project(":x-pack:plugin:core") - testImplementation project(path: xpackModule('ml')) -} - -testClusters.integTest { +testClusters.all { testDistribution = 'DEFAULT' numberOfNodes = 3 setting 'xpack.security.enabled', 'false' diff --git a/x-pack/plugin/ml/qa/basic-multi-node/src/test/java/org/elasticsearch/xpack/ml/integration/MlBasicMultiNodeIT.java b/x-pack/plugin/ml/qa/basic-multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/MlBasicMultiNodeIT.java similarity index 85% rename from x-pack/plugin/ml/qa/basic-multi-node/src/test/java/org/elasticsearch/xpack/ml/integration/MlBasicMultiNodeIT.java rename to x-pack/plugin/ml/qa/basic-multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/MlBasicMultiNodeIT.java index 9fb9df019a284..dcfd97ff4fc5f 100644 --- a/x-pack/plugin/ml/qa/basic-multi-node/src/test/java/org/elasticsearch/xpack/ml/integration/MlBasicMultiNodeIT.java +++ b/x-pack/plugin/ml/qa/basic-multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/MlBasicMultiNodeIT.java @@ -13,7 +13,6 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.test.rest.ESRestTestCase; -import org.elasticsearch.xpack.ml.MachineLearning; import org.yaml.snakeyaml.util.UriEncoder; import java.io.IOException; @@ -29,6 +28,8 @@ public class MlBasicMultiNodeIT extends ESRestTestCase { + private static final String BASE_PATH = "/_ml/"; + public void testMachineLearningInstalled() throws Exception { Response response = client().performRequest(new Request("GET", "/_xpack")); Map features = (Map) entityAsMap(response).get("features"); @@ -55,10 +56,10 @@ public void testMiniFarequote() throws Exception { createFarequoteJob(jobId); Response openResponse = client().performRequest( - new Request("POST", MachineLearning.BASE_PATH + "anomaly_detectors/" + jobId + "/_open")); + new Request("POST", BASE_PATH + "anomaly_detectors/" + jobId + "/_open")); assertThat(entityAsMap(openResponse), hasEntry("opened", true)); - Request addData = new Request("POST", MachineLearning.BASE_PATH + "anomaly_detectors/" + jobId + "/_data"); + Request addData = new Request("POST", BASE_PATH + "anomaly_detectors/" + jobId + "/_data"); addData.setEntity(new NStringEntity( "{\"airline\":\"AAL\",\"responsetime\":\"132.2046\",\"sourcetype\":\"farequote\",\"time\":\"1403481600\"}\n" + "{\"airline\":\"JZA\",\"responsetime\":\"990.4628\",\"sourcetype\":\"farequote\",\"time\":\"1403481700\"}", @@ -78,16 +79,16 @@ public void testMiniFarequote() throws Exception { assertEquals(1403481700000L, responseBody.get("latest_record_timestamp")); Response flushResponse = client().performRequest( - new Request("POST", MachineLearning.BASE_PATH + "anomaly_detectors/" + jobId + "/_flush")); + new Request("POST", BASE_PATH + "anomaly_detectors/" + jobId + "/_flush")); assertFlushResponse(flushResponse, true, 1403481600000L); - Request closeRequest = new Request("POST", MachineLearning.BASE_PATH + "anomaly_detectors/" + jobId + "/_close"); + Request closeRequest = new Request("POST", BASE_PATH + "anomaly_detectors/" + jobId + "/_close"); closeRequest.addParameter("timeout", "20s"); Response closeResponse = client().performRequest(closeRequest); assertEquals(Collections.singletonMap("closed", true), entityAsMap(closeResponse)); Response statsResponse = client().performRequest( - new Request("GET", MachineLearning.BASE_PATH + "anomaly_detectors/" + jobId + "/_stats")); + new Request("GET", BASE_PATH + "anomaly_detectors/" + jobId + "/_stats")); Map dataCountsDoc = (Map) ((Map)((List) entityAsMap(statsResponse).get("jobs")).get(0)).get("data_counts"); assertEquals(2, dataCountsDoc.get("processed_record_count")); @@ -101,7 +102,7 @@ public void testMiniFarequote() throws Exception { assertEquals(1403481600000L, dataCountsDoc.get("earliest_record_timestamp")); assertEquals(1403481700000L, dataCountsDoc.get("latest_record_timestamp")); - client().performRequest(new Request("DELETE", MachineLearning.BASE_PATH + "anomaly_detectors/" + jobId)); + client().performRequest(new Request("DELETE", BASE_PATH + "anomaly_detectors/" + jobId)); } public void testMiniFarequoteWithDatafeeder() throws Exception { @@ -136,10 +137,10 @@ public void testMiniFarequoteWithDatafeeder() throws Exception { createDatafeed(datafeedId, jobId); Response openResponse = client().performRequest( - new Request("POST", MachineLearning.BASE_PATH + "anomaly_detectors/" + jobId + "/_open")); + new Request("POST", BASE_PATH + "anomaly_detectors/" + jobId + "/_open")); assertThat(entityAsMap(openResponse), hasEntry("opened", true)); - Request startRequest = new Request("POST", MachineLearning.BASE_PATH + "datafeeds/" + datafeedId + "/_start"); + Request startRequest = new Request("POST", BASE_PATH + "datafeeds/" + datafeedId + "/_start"); startRequest.addParameter("start", "0"); Response startResponse = client().performRequest(startRequest); assertThat(entityAsMap(startResponse), hasEntry("started", true)); @@ -147,7 +148,7 @@ public void testMiniFarequoteWithDatafeeder() throws Exception { assertBusy(() -> { try { Response statsResponse = client().performRequest( - new Request("GET", MachineLearning.BASE_PATH + "anomaly_detectors/" + jobId + "/_stats")); + new Request("GET", BASE_PATH + "anomaly_detectors/" + jobId + "/_stats")); Map dataCountsDoc = (Map) ((Map)((List) entityAsMap(statsResponse).get("jobs")).get(0)).get("data_counts"); assertEquals(2, dataCountsDoc.get("input_record_count")); @@ -158,16 +159,16 @@ public void testMiniFarequoteWithDatafeeder() throws Exception { }); Response stopResponse = client().performRequest( - new Request("POST", MachineLearning.BASE_PATH + "datafeeds/" + datafeedId + "/_stop")); + new Request("POST", BASE_PATH + "datafeeds/" + datafeedId + "/_stop")); assertEquals(Collections.singletonMap("stopped", true), entityAsMap(stopResponse)); - Request closeRequest = new Request("POST", MachineLearning.BASE_PATH + "anomaly_detectors/" + jobId + "/_close"); + Request closeRequest = new Request("POST", BASE_PATH + "anomaly_detectors/" + jobId + "/_close"); closeRequest.addParameter("timeout", "20s"); assertEquals(Collections.singletonMap("closed", true), entityAsMap(client().performRequest(closeRequest))); - client().performRequest(new Request("DELETE", MachineLearning.BASE_PATH + "datafeeds/" + datafeedId)); - client().performRequest(new Request("DELETE", MachineLearning.BASE_PATH + "anomaly_detectors/" + jobId)); + client().performRequest(new Request("DELETE", BASE_PATH + "datafeeds/" + datafeedId)); + client().performRequest(new Request("DELETE", BASE_PATH + "anomaly_detectors/" + jobId)); } public void testMiniFarequoteReopen() throws Exception { @@ -175,10 +176,10 @@ public void testMiniFarequoteReopen() throws Exception { createFarequoteJob(jobId); Response openResponse = client().performRequest( - new Request("POST", MachineLearning.BASE_PATH + "anomaly_detectors/" + jobId + "/_open")); + new Request("POST", BASE_PATH + "anomaly_detectors/" + jobId + "/_open")); assertThat(entityAsMap(openResponse), hasEntry("opened", true)); - Request addDataRequest = new Request("POST", MachineLearning.BASE_PATH + "anomaly_detectors/" + jobId + "/_data"); + Request addDataRequest = new Request("POST", BASE_PATH + "anomaly_detectors/" + jobId + "/_data"); addDataRequest.setEntity(new NStringEntity( "{\"airline\":\"AAL\",\"responsetime\":\"132.2046\",\"sourcetype\":\"farequote\",\"time\":\"1403481600\"}\n" + "{\"airline\":\"JZA\",\"responsetime\":\"990.4628\",\"sourcetype\":\"farequote\",\"time\":\"1403481700\"}\n" + @@ -201,24 +202,24 @@ public void testMiniFarequoteReopen() throws Exception { assertEquals(1403482000000L, responseBody.get("latest_record_timestamp")); Response flushResponse = client().performRequest( - new Request("POST", MachineLearning.BASE_PATH + "anomaly_detectors/" + jobId + "/_flush")); + new Request("POST", BASE_PATH + "anomaly_detectors/" + jobId + "/_flush")); assertFlushResponse(flushResponse, true, 1403481600000L); - Request closeRequest = new Request("POST", MachineLearning.BASE_PATH + "anomaly_detectors/" + jobId + "/_close"); + Request closeRequest = new Request("POST", BASE_PATH + "anomaly_detectors/" + jobId + "/_close"); closeRequest.addParameter("timeout", "20s"); assertEquals(Collections.singletonMap("closed", true), entityAsMap(client().performRequest(closeRequest))); - Request statsRequest = new Request("GET", MachineLearning.BASE_PATH + "anomaly_detectors/" + jobId + "/_stats"); + Request statsRequest = new Request("GET", BASE_PATH + "anomaly_detectors/" + jobId + "/_stats"); client().performRequest(statsRequest); - Request openRequest = new Request("POST", MachineLearning.BASE_PATH + "anomaly_detectors/" + jobId + "/_open"); + Request openRequest = new Request("POST", BASE_PATH + "anomaly_detectors/" + jobId + "/_open"); openRequest.addParameter("timeout", "20s"); Response openResponse2 = client().performRequest(openRequest); assertThat(entityAsMap(openResponse2), hasEntry("opened", true)); // feed some more data points - Request addDataRequest2 = new Request("POST", MachineLearning.BASE_PATH + "anomaly_detectors/" + jobId + "/_data"); + Request addDataRequest2 = new Request("POST", BASE_PATH + "anomaly_detectors/" + jobId + "/_data"); addDataRequest2.setEntity(new NStringEntity( "{\"airline\":\"AAL\",\"responsetime\":\"136.2361\",\"sourcetype\":\"farequote\",\"time\":\"1407081600\"}\n" + "{\"airline\":\"VRD\",\"responsetime\":\"282.9847\",\"sourcetype\":\"farequote\",\"time\":\"1407081700\"}\n" + @@ -261,7 +262,7 @@ public void testMiniFarequoteReopen() throws Exception { assertEquals(1403481600000L, dataCountsDoc.get("earliest_record_timestamp")); assertEquals(1407082000000L, dataCountsDoc.get("latest_record_timestamp")); - client().performRequest(new Request("DELETE", MachineLearning.BASE_PATH + "anomaly_detectors/" + jobId)); + client().performRequest(new Request("DELETE", BASE_PATH + "anomaly_detectors/" + jobId)); } private Response createDatafeed(String datafeedId, String jobId) throws Exception { @@ -270,7 +271,7 @@ private Response createDatafeed(String datafeedId, String jobId) throws Exceptio xContentBuilder.field("job_id", jobId); xContentBuilder.array("indexes", "airline-data"); xContentBuilder.endObject(); - Request request = new Request("PUT", MachineLearning.BASE_PATH + "datafeeds/" + datafeedId); + Request request = new Request("PUT", BASE_PATH + "datafeeds/" + datafeedId); request.setJsonEntity(Strings.toString(xContentBuilder)); return client().performRequest(request); } @@ -309,7 +310,7 @@ private Response createFarequoteJob(String jobId) throws Exception { } xContentBuilder.endObject(); - Request request = new Request("PUT", MachineLearning.BASE_PATH + "anomaly_detectors/" + UriEncoder.encode(jobId)); + Request request = new Request("PUT", BASE_PATH + "anomaly_detectors/" + UriEncoder.encode(jobId)); request.setJsonEntity(Strings.toString(xContentBuilder)); return client().performRequest(request); } diff --git a/x-pack/plugin/ml/qa/disabled/build.gradle b/x-pack/plugin/ml/qa/disabled/build.gradle index b53d322c8fa96..7ad18743ca889 100644 --- a/x-pack/plugin/ml/qa/disabled/build.gradle +++ b/x-pack/plugin/ml/qa/disabled/build.gradle @@ -1,13 +1,11 @@ -apply plugin: 'elasticsearch.testclusters' -apply plugin: 'elasticsearch.standalone-rest-test' -apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.java-rest-test' -dependencies { - testImplementation project(":x-pack:plugin:core") - testImplementation project(path: xpackModule('ml')) -} +//dependencies { +// testImplementation project(":x-pack:plugin:core") +// testImplementation project(path: xpackModule('ml')) +//} -testClusters.integTest { +testClusters.all { testDistribution = 'DEFAULT' setting 'xpack.security.enabled', 'false' setting 'xpack.ml.enabled', 'false' diff --git a/x-pack/plugin/ml/qa/disabled/src/test/java/org/elasticsearch/xpack/ml/integration/MlPluginDisabledIT.java b/x-pack/plugin/ml/qa/disabled/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/MlPluginDisabledIT.java similarity index 94% rename from x-pack/plugin/ml/qa/disabled/src/test/java/org/elasticsearch/xpack/ml/integration/MlPluginDisabledIT.java rename to x-pack/plugin/ml/qa/disabled/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/MlPluginDisabledIT.java index b3485b266d877..0fa09dbfa302d 100644 --- a/x-pack/plugin/ml/qa/disabled/src/test/java/org/elasticsearch/xpack/ml/integration/MlPluginDisabledIT.java +++ b/x-pack/plugin/ml/qa/disabled/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/MlPluginDisabledIT.java @@ -10,13 +10,14 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.test.rest.ESRestTestCase; -import org.elasticsearch.xpack.ml.MachineLearning; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.hamcrest.Matchers.containsString; public class MlPluginDisabledIT extends ESRestTestCase { + private static final String BASE_PATH = "/_ml/"; + /** * Check that when the ml plugin is disabled, you cannot create a job as the * rest handler is not registered @@ -55,7 +56,7 @@ public void testActionsFail() throws Exception { } xContentBuilder.endObject(); - Request request = new Request("PUT", MachineLearning.BASE_PATH + "anomaly_detectors/foo"); + Request request = new Request("PUT", BASE_PATH + "anomaly_detectors/foo"); request.setJsonEntity(Strings.toString(xContentBuilder)); ResponseException exception = expectThrows(ResponseException.class, () -> client().performRequest(request)); assertThat(exception.getMessage(), containsString("method [PUT]")); diff --git a/x-pack/plugin/ml/qa/ml-with-security/build.gradle b/x-pack/plugin/ml/qa/ml-with-security/build.gradle index c2f6a674fbbe1..40f1dd1d7c144 100644 --- a/x-pack/plugin/ml/qa/ml-with-security/build.gradle +++ b/x-pack/plugin/ml/qa/ml-with-security/build.gradle @@ -1,12 +1,9 @@ -apply plugin: 'elasticsearch.testclusters' -apply plugin: 'elasticsearch.standalone-rest-test' -apply plugin: 'elasticsearch.rest-test' -apply plugin: 'elasticsearch.rest-resources' +apply plugin: 'elasticsearch.yaml-rest-test' dependencies { - testImplementation project(path: xpackModule('core'), configuration: 'default') - testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts') - testImplementation project(path: xpackProject('plugin').path, configuration: 'testArtifacts') + yamlRestTestImplementation project(path: xpackModule('core'), configuration: 'testArtifacts') + yamlRestTestImplementation project(path: xpackModule('core')) + yamlRestTestImplementation project(path: xpackProject('plugin').path, configuration: 'testArtifacts') } // bring in machine learning rest test suite @@ -20,7 +17,7 @@ restResources { } } -integTest { +yamlRestTest { systemProperty 'tests.rest.blacklist', [ // Remove this test because it doesn't call an ML endpoint and we don't want // to grant extra permissions to the users used in this test suite @@ -213,7 +210,7 @@ integTest { } -testClusters.integTest { +testClusters.all { testDistribution = 'DEFAULT' extraConfigFile 'roles.yml', file('roles.yml') user username: "x_pack_rest_user", password: "x-pack-test-password" diff --git a/x-pack/plugin/ml/qa/ml-with-security/src/test/java/org/elasticsearch/smoketest/MlWithSecurityIT.java b/x-pack/plugin/ml/qa/ml-with-security/src/yamlRestTest/java/org/elasticsearch/smoketest/MlWithSecurityIT.java similarity index 100% rename from x-pack/plugin/ml/qa/ml-with-security/src/test/java/org/elasticsearch/smoketest/MlWithSecurityIT.java rename to x-pack/plugin/ml/qa/ml-with-security/src/yamlRestTest/java/org/elasticsearch/smoketest/MlWithSecurityIT.java diff --git a/x-pack/plugin/ml/qa/ml-with-security/src/test/java/org/elasticsearch/smoketest/MlWithSecurityInsufficientRoleIT.java b/x-pack/plugin/ml/qa/ml-with-security/src/yamlRestTest/java/org/elasticsearch/smoketest/MlWithSecurityInsufficientRoleIT.java similarity index 100% rename from x-pack/plugin/ml/qa/ml-with-security/src/test/java/org/elasticsearch/smoketest/MlWithSecurityInsufficientRoleIT.java rename to x-pack/plugin/ml/qa/ml-with-security/src/yamlRestTest/java/org/elasticsearch/smoketest/MlWithSecurityInsufficientRoleIT.java diff --git a/x-pack/plugin/ml/qa/ml-with-security/src/test/java/org/elasticsearch/smoketest/MlWithSecurityUserRoleIT.java b/x-pack/plugin/ml/qa/ml-with-security/src/yamlRestTest/java/org/elasticsearch/smoketest/MlWithSecurityUserRoleIT.java similarity index 100% rename from x-pack/plugin/ml/qa/ml-with-security/src/test/java/org/elasticsearch/smoketest/MlWithSecurityUserRoleIT.java rename to x-pack/plugin/ml/qa/ml-with-security/src/yamlRestTest/java/org/elasticsearch/smoketest/MlWithSecurityUserRoleIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle b/x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle index b8823f71f9c5d..4d2570f92ffff 100644 --- a/x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle +++ b/x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle @@ -1,14 +1,17 @@ -apply plugin: 'elasticsearch.testclusters' -apply plugin: 'elasticsearch.standalone-rest-test' -apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.internal-cluster-test' +apply plugin: 'elasticsearch.java-rest-test' dependencies { - testImplementation project(path: xpackModule('core'), configuration: 'default') - testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts') - testImplementation project(path: xpackModule('ml')) - testImplementation project(path: xpackModule('ml'), configuration: 'testArtifacts') - testImplementation project(path: ':modules:ingest-common') - testImplementation project(path: xpackModule('data-streams')) + internalClusterTestImplementation project(path: xpackModule('core'), configuration: 'default') + internalClusterTestImplementation project(path: xpackModule('core'), configuration: 'testArtifacts') + internalClusterTestImplementation project(path: xpackModule('ml')) + internalClusterTestImplementation project(path: xpackModule('ml'), configuration: 'testArtifacts') + internalClusterTestImplementation project(path: ':modules:ingest-common') + internalClusterTestImplementation project(path: xpackModule('data-streams')) + + javaRestTestImplementation project(path: xpackModule('core')) + javaRestTestImplementation project(path: xpackModule('ml')) + javaRestTestImplementation project(path: xpackModule('ml'), configuration: 'testArtifacts') } // location for keys and certificates @@ -23,10 +26,10 @@ tasks.register("copyKeyCerts", Copy) { into keystoreDir } // Add keys and cets to test classpath: it expects it there -sourceSets.test.resources.srcDir(keystoreDir) -tasks.named("processTestResources").configure { dependsOn("copyKeyCerts") } +sourceSets.javaRestTest.resources.srcDir(keystoreDir) +tasks.named("processJavaRestTestResources").configure { dependsOn("copyKeyCerts") } -integTest { +javaRestTest { dependsOn "copyKeyCerts" /* * We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each @@ -35,7 +38,11 @@ integTest { systemProperty 'es.set.netty.runtime.available.processors', 'false' } -testClusters.integTest { +internalClusterTest { + systemProperty 'es.set.netty.runtime.available.processors', 'false' +} + +testClusters.all { numberOfNodes = 3 testDistribution = 'DEFAULT' diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/AutodetectMemoryLimitIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/AutodetectMemoryLimitIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/AutodetectMemoryLimitIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/AutodetectMemoryLimitIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/BasicRenormalizationIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/BasicRenormalizationIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/BasicRenormalizationIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/BasicRenormalizationIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/BulkFailureRetryIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/BulkFailureRetryIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/BulkFailureRetryIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/BulkFailureRetryIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/CategorizationIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/CategorizationIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/CategorizationIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/CategorizationIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/ClassificationEvaluationIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/ClassificationEvaluationIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/ClassificationEvaluationIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/ClassificationEvaluationIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/ClassificationIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/ClassificationIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/ClassificationIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/ClassificationIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DatafeedWithAggsIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/DatafeedWithAggsIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DatafeedWithAggsIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/DatafeedWithAggsIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DelayedDataDetectorIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/DelayedDataDetectorIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DelayedDataDetectorIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/DelayedDataDetectorIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DeleteExpiredDataIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/DeleteExpiredDataIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DeleteExpiredDataIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/DeleteExpiredDataIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DeleteJobIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/DeleteJobIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DeleteJobIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/DeleteJobIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DetectionRulesIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/DetectionRulesIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DetectionRulesIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/DetectionRulesIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/ExplainDataFrameAnalyticsIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/ExplainDataFrameAnalyticsIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/ExplainDataFrameAnalyticsIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/ExplainDataFrameAnalyticsIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/ForecastIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/ForecastIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/ForecastIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/ForecastIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/InterimResultsDeletedAfterReopeningJobIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/InterimResultsDeletedAfterReopeningJobIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/InterimResultsDeletedAfterReopeningJobIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/InterimResultsDeletedAfterReopeningJobIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/InterimResultsIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/InterimResultsIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/InterimResultsIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/InterimResultsIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/JobAndDatafeedResilienceIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/JobAndDatafeedResilienceIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/JobAndDatafeedResilienceIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/JobAndDatafeedResilienceIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/MlDailyMaintenanceServiceIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/MlDailyMaintenanceServiceIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/MlDailyMaintenanceServiceIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/MlDailyMaintenanceServiceIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/MlNativeAutodetectIntegTestCase.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/MlNativeAutodetectIntegTestCase.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/MlNativeAutodetectIntegTestCase.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/MlNativeAutodetectIntegTestCase.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/MlNativeDataFrameAnalyticsIntegTestCase.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/MlNativeDataFrameAnalyticsIntegTestCase.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/MlNativeDataFrameAnalyticsIntegTestCase.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/MlNativeDataFrameAnalyticsIntegTestCase.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/MlNativeIntegTestCase.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/MlNativeIntegTestCase.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/MlNativeIntegTestCase.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/MlNativeIntegTestCase.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/ModelPlotsIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/ModelPlotsIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/ModelPlotsIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/ModelPlotsIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/ModelSnapshotRetentionIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/ModelSnapshotRetentionIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/ModelSnapshotRetentionIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/ModelSnapshotRetentionIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/OutlierDetectionWithMissingFieldsIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/OutlierDetectionWithMissingFieldsIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/OutlierDetectionWithMissingFieldsIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/OutlierDetectionWithMissingFieldsIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/OverallBucketsIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/OverallBucketsIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/OverallBucketsIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/OverallBucketsIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/PersistJobIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/PersistJobIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/PersistJobIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/PersistJobIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/RegressionEvaluationIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/RegressionEvaluationIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/RegressionEvaluationIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/RegressionEvaluationIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/RegressionIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/RegressionIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/RegressionIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/RegressionIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/ReopenJobWithGapIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/ReopenJobWithGapIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/ReopenJobWithGapIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/ReopenJobWithGapIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/RestoreModelSnapshotIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/RestoreModelSnapshotIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/RestoreModelSnapshotIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/RestoreModelSnapshotIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/RevertModelSnapshotIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/RevertModelSnapshotIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/RevertModelSnapshotIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/RevertModelSnapshotIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/RunDataFrameAnalyticsIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/RunDataFrameAnalyticsIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/RunDataFrameAnalyticsIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/RunDataFrameAnalyticsIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/ScheduledEventsIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/ScheduledEventsIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/ScheduledEventsIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/ScheduledEventsIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/SetUpgradeModeIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/SetUpgradeModeIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/SetUpgradeModeIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/SetUpgradeModeIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/ClassificationEvaluationWithSecurityIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/ClassificationEvaluationWithSecurityIT.java similarity index 89% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/ClassificationEvaluationWithSecurityIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/ClassificationEvaluationWithSecurityIT.java index 033173a3691e0..35199b6d89a54 100644 --- a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/ClassificationEvaluationWithSecurityIT.java +++ b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/ClassificationEvaluationWithSecurityIT.java @@ -13,6 +13,7 @@ import org.elasticsearch.common.util.concurrent.ThreadContext; import org.elasticsearch.test.SecuritySettingsSourceField; import org.elasticsearch.test.rest.ESRestTestCase; +import org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken; import java.io.IOException; import java.util.Arrays; @@ -24,7 +25,7 @@ public class ClassificationEvaluationWithSecurityIT extends ESRestTestCase { private static final String BASIC_AUTH_VALUE_SUPER_USER = - basicAuthHeaderValue("x_pack_rest_user", SecuritySettingsSourceField.TEST_PASSWORD_SECURE_STRING); + UsernamePasswordToken.basicAuthHeaderValue("x_pack_rest_user", SecuritySettingsSourceField.TEST_PASSWORD_SECURE_STRING); @Override protected Settings restClientSettings() { @@ -67,8 +68,8 @@ public void testEvaluate_withSecurity() throws Exception { setupDataAccessRole(index); setupUser("ml_admin", Collections.singletonList("machine_learning_admin")); setupUser("ml_admin_plus_data", Arrays.asList("machine_learning_admin", "test_data_access")); - String mlAdmin = basicAuthHeaderValue("ml_admin", SecuritySettingsSourceField.TEST_PASSWORD_SECURE_STRING); - String mlAdminPlusData = basicAuthHeaderValue("ml_admin_plus_data", SecuritySettingsSourceField.TEST_PASSWORD_SECURE_STRING); + String mlAdmin = UsernamePasswordToken.basicAuthHeaderValue("ml_admin", SecuritySettingsSourceField.TEST_PASSWORD_SECURE_STRING); + String mlAdminPlusData = UsernamePasswordToken.basicAuthHeaderValue("ml_admin_plus_data", SecuritySettingsSourceField.TEST_PASSWORD_SECURE_STRING); Request evaluateRequest = buildRegressionEval(index, mlAdmin, mlAdminPlusData); client().performRequest(evaluateRequest); diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsRestIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsRestIT.java similarity index 99% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsRestIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsRestIT.java index a3d0cff23d54f..ada09ef47599e 100644 --- a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsRestIT.java +++ b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsRestIT.java @@ -19,6 +19,7 @@ import org.elasticsearch.xpack.core.ml.integration.MlRestTestStateCleaner; import org.elasticsearch.xpack.core.ml.notifications.NotificationsIndex; import org.elasticsearch.xpack.core.rollup.job.RollupJob; +import org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken; import org.elasticsearch.xpack.ml.MachineLearning; import org.junit.After; import org.junit.Before; @@ -40,11 +41,11 @@ public class DatafeedJobsRestIT extends ESRestTestCase { private static final String BASIC_AUTH_VALUE_SUPER_USER = - basicAuthHeaderValue("x_pack_rest_user", SecuritySettingsSourceField.TEST_PASSWORD_SECURE_STRING); + UsernamePasswordToken.basicAuthHeaderValue("x_pack_rest_user", SecuritySettingsSourceField.TEST_PASSWORD_SECURE_STRING); private static final String BASIC_AUTH_VALUE_ML_ADMIN = - basicAuthHeaderValue("ml_admin", SecuritySettingsSourceField.TEST_PASSWORD_SECURE_STRING); + UsernamePasswordToken.basicAuthHeaderValue("ml_admin", SecuritySettingsSourceField.TEST_PASSWORD_SECURE_STRING); private static final String BASIC_AUTH_VALUE_ML_ADMIN_WITH_SOME_DATA_ACCESS = - basicAuthHeaderValue("ml_admin_plus_data", SecuritySettingsSourceField.TEST_PASSWORD_SECURE_STRING); + UsernamePasswordToken.basicAuthHeaderValue("ml_admin_plus_data", SecuritySettingsSourceField.TEST_PASSWORD_SECURE_STRING); @Override protected Settings restClientSettings() { diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/InferenceIngestIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/InferenceIngestIT.java similarity index 98% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/InferenceIngestIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/InferenceIngestIT.java index 64e7d7559ef17..63546d3261b04 100644 --- a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/InferenceIngestIT.java +++ b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/InferenceIngestIT.java @@ -25,7 +25,9 @@ import org.elasticsearch.xpack.core.ml.MlStatsIndex; import org.elasticsearch.xpack.core.ml.inference.MlInferenceNamedXContentProvider; import org.elasticsearch.xpack.core.ml.inference.persistence.InferenceIndexConstants; +import org.elasticsearch.xpack.core.ml.inference.trainedmodel.inference.InferenceDefinitionTests; import org.elasticsearch.xpack.core.ml.integration.MlRestTestStateCleaner; +import org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken; import org.junit.After; import org.junit.Before; @@ -46,7 +48,7 @@ public class InferenceIngestIT extends ESRestTestCase { private static final String BASIC_AUTH_VALUE_SUPER_USER = - basicAuthHeaderValue("x_pack_rest_user", SecuritySettingsSourceField.TEST_PASSWORD_SECURE_STRING); + UsernamePasswordToken.basicAuthHeaderValue("x_pack_rest_user", SecuritySettingsSourceField.TEST_PASSWORD_SECURE_STRING); @Before public void setup() throws Exception { @@ -534,7 +536,7 @@ protected NamedXContentRegistry xContentRegistry() { " \"description\": \"test model for classification\",\n" + " \"default_field_map\": {\"col_1_alias\": \"col1\"},\n" + " \"inference_config\": {\"classification\": {}},\n" + - " \"definition\": " + getClassificationDefinition(false) + + " \"definition\": " + InferenceDefinitionTests.getClassificationDefinition(false) + "}"; private static String pipelineDefinition(String modelId, String inferenceConfig) { diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/MlJobIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/MlJobIT.java similarity index 99% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/MlJobIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/MlJobIT.java index c28de014e2ed9..7f6892842ea89 100644 --- a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/MlJobIT.java +++ b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/MlJobIT.java @@ -22,6 +22,7 @@ import org.elasticsearch.xpack.core.ml.job.persistence.AnomalyDetectorsIndex; import org.elasticsearch.xpack.core.ml.job.persistence.AnomalyDetectorsIndexFields; import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.TimingStats; +import org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken; import org.elasticsearch.xpack.ml.MachineLearning; import org.junit.After; @@ -41,7 +42,7 @@ public class MlJobIT extends ESRestTestCase { - private static final String BASIC_AUTH_VALUE = basicAuthHeaderValue("x_pack_rest_user", + private static final String BASIC_AUTH_VALUE = UsernamePasswordToken.basicAuthHeaderValue("x_pack_rest_user", SecuritySettingsSourceField.TEST_PASSWORD_SECURE_STRING); @Override diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/TrainedModelIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/TrainedModelIT.java similarity index 98% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/TrainedModelIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/TrainedModelIT.java index 0500424a289e8..c0d6cd3d41969 100644 --- a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/TrainedModelIT.java +++ b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/TrainedModelIT.java @@ -32,6 +32,7 @@ import org.elasticsearch.xpack.core.ml.inference.persistence.InferenceIndexConstants; import org.elasticsearch.xpack.core.ml.integration.MlRestTestStateCleaner; import org.elasticsearch.xpack.core.ml.job.messages.Messages; +import org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken; import org.elasticsearch.xpack.ml.MachineLearning; import org.elasticsearch.xpack.ml.inference.persistence.TrainedModelDefinitionDoc; import org.junit.After; @@ -49,7 +50,7 @@ public class TrainedModelIT extends ESRestTestCase { - private static final String BASIC_AUTH_VALUE = basicAuthHeaderValue("x_pack_rest_user", + private static final String BASIC_AUTH_VALUE = UsernamePasswordToken.basicAuthHeaderValue("x_pack_rest_user", SecuritySettingsSourceField.TEST_PASSWORD_SECURE_STRING); @Override From 9cfb7cc971514747080daa4416fb483d1e80eb38 Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Wed, 5 Aug 2020 15:46:50 -0500 Subject: [PATCH 19/25] ml - part 2 --- .../ml/qa/native-multi-node-tests/build.gradle | 17 ++++------------- .../ml/integration/AutodetectMemoryLimitIT.java | 0 .../ml/integration/BasicRenormalizationIT.java | 0 .../ml/integration/BulkFailureRetryIT.java | 0 .../xpack/ml/integration/CategorizationIT.java | 0 .../integration/ClassificationEvaluationIT.java | 0 .../xpack/ml/integration/ClassificationIT.java | 0 .../xpack/ml/integration/DatafeedJobsIT.java | 0 .../ml/integration/DatafeedWithAggsIT.java | 0 .../ml/integration/DelayedDataDetectorIT.java | 0 .../ml/integration/DeleteExpiredDataIT.java | 0 .../xpack/ml/integration/DeleteJobIT.java | 0 .../xpack/ml/integration/DetectionRulesIT.java | 0 .../ExplainDataFrameAnalyticsIT.java | 0 .../xpack/ml/integration/ForecastIT.java | 0 ...nterimResultsDeletedAfterReopeningJobIT.java | 0 .../xpack/ml/integration/InterimResultsIT.java | 0 .../integration/JobAndDatafeedResilienceIT.java | 0 .../MlDailyMaintenanceServiceIT.java | 0 .../MlNativeAutodetectIntegTestCase.java | 0 ...MlNativeDataFrameAnalyticsIntegTestCase.java | 0 .../ml/integration/MlNativeIntegTestCase.java | 0 .../xpack/ml/integration/ModelPlotsIT.java | 0 .../integration/ModelSnapshotRetentionIT.java | 0 .../OutlierDetectionWithMissingFieldsIT.java | 0 .../xpack/ml/integration/OverallBucketsIT.java | 0 .../xpack/ml/integration/PersistJobIT.java | 0 .../ml/integration/RegressionEvaluationIT.java | 0 .../xpack/ml/integration/RegressionIT.java | 0 .../ml/integration/ReopenJobWithGapIT.java | 0 .../ml/integration/RestoreModelSnapshotIT.java | 0 .../ml/integration/RevertModelSnapshotIT.java | 0 .../ml/integration/RunDataFrameAnalyticsIT.java | 0 .../xpack/ml/integration/ScheduledEventsIT.java | 0 .../xpack/ml/integration/SetUpgradeModeIT.java | 0 35 files changed, 4 insertions(+), 13 deletions(-) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/AutodetectMemoryLimitIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/BasicRenormalizationIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/BulkFailureRetryIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/CategorizationIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/ClassificationEvaluationIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/ClassificationIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/DatafeedWithAggsIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/DelayedDataDetectorIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/DeleteExpiredDataIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/DeleteJobIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/DetectionRulesIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/ExplainDataFrameAnalyticsIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/ForecastIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/InterimResultsDeletedAfterReopeningJobIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/InterimResultsIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/JobAndDatafeedResilienceIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/MlDailyMaintenanceServiceIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/MlNativeAutodetectIntegTestCase.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/MlNativeDataFrameAnalyticsIntegTestCase.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/MlNativeIntegTestCase.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/ModelPlotsIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/ModelSnapshotRetentionIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/OutlierDetectionWithMissingFieldsIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/OverallBucketsIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/PersistJobIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/RegressionEvaluationIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/RegressionIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/ReopenJobWithGapIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/RestoreModelSnapshotIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/RevertModelSnapshotIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/RunDataFrameAnalyticsIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/ScheduledEventsIT.java (100%) rename x-pack/plugin/ml/qa/native-multi-node-tests/src/{internalClusterTest => javaRestTest}/java/org/elasticsearch/xpack/ml/integration/SetUpgradeModeIT.java (100%) diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle b/x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle index 4d2570f92ffff..cedfbf0ff8fe8 100644 --- a/x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle +++ b/x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle @@ -1,17 +1,12 @@ -apply plugin: 'elasticsearch.internal-cluster-test' apply plugin: 'elasticsearch.java-rest-test' dependencies { - internalClusterTestImplementation project(path: xpackModule('core'), configuration: 'default') - internalClusterTestImplementation project(path: xpackModule('core'), configuration: 'testArtifacts') - internalClusterTestImplementation project(path: xpackModule('ml')) - internalClusterTestImplementation project(path: xpackModule('ml'), configuration: 'testArtifacts') - internalClusterTestImplementation project(path: ':modules:ingest-common') - internalClusterTestImplementation project(path: xpackModule('data-streams')) - - javaRestTestImplementation project(path: xpackModule('core')) + javaRestTestImplementation project(path: xpackModule('core'), configuration: 'default') + javaRestTestImplementation project(path: xpackModule('core'), configuration: 'testArtifacts') javaRestTestImplementation project(path: xpackModule('ml')) javaRestTestImplementation project(path: xpackModule('ml'), configuration: 'testArtifacts') + javaRestTestImplementation project(path: ':modules:ingest-common') + javaRestTestImplementation project(path: xpackModule('data-streams')) } // location for keys and certificates @@ -38,10 +33,6 @@ javaRestTest { systemProperty 'es.set.netty.runtime.available.processors', 'false' } -internalClusterTest { - systemProperty 'es.set.netty.runtime.available.processors', 'false' -} - testClusters.all { numberOfNodes = 3 testDistribution = 'DEFAULT' diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/AutodetectMemoryLimitIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/AutodetectMemoryLimitIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/AutodetectMemoryLimitIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/AutodetectMemoryLimitIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/BasicRenormalizationIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/BasicRenormalizationIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/BasicRenormalizationIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/BasicRenormalizationIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/BulkFailureRetryIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/BulkFailureRetryIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/BulkFailureRetryIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/BulkFailureRetryIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/CategorizationIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/CategorizationIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/CategorizationIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/CategorizationIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/ClassificationEvaluationIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/ClassificationEvaluationIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/ClassificationEvaluationIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/ClassificationEvaluationIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/ClassificationIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/ClassificationIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/ClassificationIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/ClassificationIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/DatafeedWithAggsIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/DatafeedWithAggsIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/DatafeedWithAggsIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/DatafeedWithAggsIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/DelayedDataDetectorIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/DelayedDataDetectorIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/DelayedDataDetectorIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/DelayedDataDetectorIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/DeleteExpiredDataIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/DeleteExpiredDataIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/DeleteExpiredDataIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/DeleteExpiredDataIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/DeleteJobIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/DeleteJobIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/DeleteJobIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/DeleteJobIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/DetectionRulesIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/DetectionRulesIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/DetectionRulesIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/DetectionRulesIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/ExplainDataFrameAnalyticsIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/ExplainDataFrameAnalyticsIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/ExplainDataFrameAnalyticsIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/ExplainDataFrameAnalyticsIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/ForecastIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/ForecastIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/ForecastIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/ForecastIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/InterimResultsDeletedAfterReopeningJobIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/InterimResultsDeletedAfterReopeningJobIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/InterimResultsDeletedAfterReopeningJobIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/InterimResultsDeletedAfterReopeningJobIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/InterimResultsIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/InterimResultsIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/InterimResultsIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/InterimResultsIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/JobAndDatafeedResilienceIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/JobAndDatafeedResilienceIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/JobAndDatafeedResilienceIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/JobAndDatafeedResilienceIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/MlDailyMaintenanceServiceIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/MlDailyMaintenanceServiceIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/MlDailyMaintenanceServiceIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/MlDailyMaintenanceServiceIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/MlNativeAutodetectIntegTestCase.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/MlNativeAutodetectIntegTestCase.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/MlNativeAutodetectIntegTestCase.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/MlNativeAutodetectIntegTestCase.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/MlNativeDataFrameAnalyticsIntegTestCase.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/MlNativeDataFrameAnalyticsIntegTestCase.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/MlNativeDataFrameAnalyticsIntegTestCase.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/MlNativeDataFrameAnalyticsIntegTestCase.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/MlNativeIntegTestCase.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/MlNativeIntegTestCase.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/MlNativeIntegTestCase.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/MlNativeIntegTestCase.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/ModelPlotsIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/ModelPlotsIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/ModelPlotsIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/ModelPlotsIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/ModelSnapshotRetentionIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/ModelSnapshotRetentionIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/ModelSnapshotRetentionIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/ModelSnapshotRetentionIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/OutlierDetectionWithMissingFieldsIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/OutlierDetectionWithMissingFieldsIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/OutlierDetectionWithMissingFieldsIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/OutlierDetectionWithMissingFieldsIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/OverallBucketsIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/OverallBucketsIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/OverallBucketsIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/OverallBucketsIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/PersistJobIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/PersistJobIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/PersistJobIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/PersistJobIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/RegressionEvaluationIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/RegressionEvaluationIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/RegressionEvaluationIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/RegressionEvaluationIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/RegressionIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/RegressionIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/RegressionIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/RegressionIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/ReopenJobWithGapIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/ReopenJobWithGapIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/ReopenJobWithGapIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/ReopenJobWithGapIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/RestoreModelSnapshotIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/RestoreModelSnapshotIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/RestoreModelSnapshotIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/RestoreModelSnapshotIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/RevertModelSnapshotIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/RevertModelSnapshotIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/RevertModelSnapshotIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/RevertModelSnapshotIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/RunDataFrameAnalyticsIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/RunDataFrameAnalyticsIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/RunDataFrameAnalyticsIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/RunDataFrameAnalyticsIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/ScheduledEventsIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/ScheduledEventsIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/ScheduledEventsIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/ScheduledEventsIT.java diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/SetUpgradeModeIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/SetUpgradeModeIT.java similarity index 100% rename from x-pack/plugin/ml/qa/native-multi-node-tests/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/SetUpgradeModeIT.java rename to x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/SetUpgradeModeIT.java From ed0186f3b1cdd8824a994188a9248c7f9999fa26 Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Wed, 5 Aug 2020 15:51:18 -0500 Subject: [PATCH 20/25] ml part 3 --- .../plugin/ml/qa/single-node-tests/build.gradle | 11 ++--------- .../ml/transforms/PainlessDomainSplitIT.java | 17 +++++++++-------- 2 files changed, 11 insertions(+), 17 deletions(-) rename x-pack/plugin/ml/qa/single-node-tests/src/{test => javaRestTest}/java/org/elasticsearch/xpack/ml/transforms/PainlessDomainSplitIT.java (96%) diff --git a/x-pack/plugin/ml/qa/single-node-tests/build.gradle b/x-pack/plugin/ml/qa/single-node-tests/build.gradle index ddb0cf9b1b132..f3610bfa98672 100644 --- a/x-pack/plugin/ml/qa/single-node-tests/build.gradle +++ b/x-pack/plugin/ml/qa/single-node-tests/build.gradle @@ -1,13 +1,6 @@ -apply plugin: 'elasticsearch.testclusters' -apply plugin: 'elasticsearch.standalone-rest-test' -apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.java-rest-test' -dependencies { - testImplementation project(":x-pack:plugin:core") - testImplementation project(path: xpackModule('ml')) -} - -testClusters.integTest { +testClusters.all { testDistribution = 'DEFAULT' setting 'xpack.security.enabled', 'false' setting 'xpack.license.self_generated.type', 'trial' diff --git a/x-pack/plugin/ml/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/ml/transforms/PainlessDomainSplitIT.java b/x-pack/plugin/ml/qa/single-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/transforms/PainlessDomainSplitIT.java similarity index 96% rename from x-pack/plugin/ml/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/ml/transforms/PainlessDomainSplitIT.java rename to x-pack/plugin/ml/qa/single-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/transforms/PainlessDomainSplitIT.java index 864bf5c3612da..0d0b022764d71 100644 --- a/x-pack/plugin/ml/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/ml/transforms/PainlessDomainSplitIT.java +++ b/x-pack/plugin/ml/qa/single-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/transforms/PainlessDomainSplitIT.java @@ -12,7 +12,6 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.rest.ESRestTestCase; -import org.elasticsearch.xpack.ml.MachineLearning; import java.time.ZoneOffset; import java.time.ZonedDateTime; @@ -30,6 +29,8 @@ public class PainlessDomainSplitIT extends ESRestTestCase { + private static final String BASE_PATH = "/_ml/"; + static class TestConfiguration { public String subDomainExpected; public String domainExpected; @@ -242,7 +243,7 @@ public void testIsolated() throws Exception { public void testHRDSplit() throws Exception { // Create job - Request createJobRequest = new Request("PUT", MachineLearning.BASE_PATH + "anomaly_detectors/hrd-split-job"); + Request createJobRequest = new Request("PUT", BASE_PATH + "anomaly_detectors/hrd-split-job"); createJobRequest.setJsonEntity( "{\n" + " \"description\":\"Domain splitting\",\n" + @@ -257,7 +258,7 @@ public void testHRDSplit() throws Exception { " }\n" + "}"); client().performRequest(createJobRequest); - client().performRequest(new Request("POST", MachineLearning.BASE_PATH + "anomaly_detectors/hrd-split-job/_open")); + client().performRequest(new Request("POST", BASE_PATH + "anomaly_detectors/hrd-split-job/_open")); // Create index to hold data Settings.Builder settings = Settings.builder() @@ -297,7 +298,7 @@ public void testHRDSplit() throws Exception { client().performRequest(new Request("POST", "/painless/_refresh")); // Create and start datafeed - Request createFeedRequest = new Request("PUT", MachineLearning.BASE_PATH + "datafeeds/hrd-split-datafeed"); + Request createFeedRequest = new Request("PUT", BASE_PATH + "datafeeds/hrd-split-datafeed"); createFeedRequest.setJsonEntity( "{\n" + " \"job_id\":\"hrd-split-job\",\n" + @@ -310,7 +311,7 @@ public void testHRDSplit() throws Exception { "}"); client().performRequest(createFeedRequest); - Request startDatafeedRequest = new Request("POST", MachineLearning.BASE_PATH + "datafeeds/hrd-split-datafeed/_start"); + Request startDatafeedRequest = new Request("POST", BASE_PATH + "datafeeds/hrd-split-datafeed/_start"); startDatafeedRequest.addParameter("start", baseTime.format(DateTimeFormatter.ISO_DATE_TIME)); startDatafeedRequest.addParameter("end", ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_DATE_TIME)); client().performRequest(startDatafeedRequest); @@ -321,7 +322,7 @@ public void testHRDSplit() throws Exception { client().performRequest(new Request("POST", "/.ml-anomalies-*/_refresh")); Response records = client().performRequest(new Request("GET", - MachineLearning.BASE_PATH + "anomaly_detectors/hrd-split-job/results/records")); + BASE_PATH + "anomaly_detectors/hrd-split-job/results/records")); String responseBody = EntityUtils.toString(records.getEntity()); assertThat("response body [" + responseBody + "] did not contain [\"count\":2]", responseBody, @@ -353,7 +354,7 @@ private void waitUntilJobIsClosed(String jobId) throws Exception { assertBusy(() -> { try { Response jobStatsResponse = client().performRequest(new Request("GET", - MachineLearning.BASE_PATH + "anomaly_detectors/" + jobId + "/_stats")); + BASE_PATH + "anomaly_detectors/" + jobId + "/_stats")); assertThat(EntityUtils.toString(jobStatsResponse.getEntity()), containsString("\"state\":\"closed\"")); } catch (Exception e) { throw new RuntimeException(e); @@ -365,7 +366,7 @@ private void waitUntilDatafeedIsStopped(String dfId) throws Exception { assertBusy(() -> { try { Response datafeedStatsResponse = client().performRequest(new Request("GET", - MachineLearning.BASE_PATH + "datafeeds/" + dfId + "/_stats")); + BASE_PATH + "datafeeds/" + dfId + "/_stats")); assertThat(EntityUtils.toString(datafeedStatsResponse.getEntity()), containsString("\"state\":\"stopped\"")); } catch (Exception e) { From bceb48c89d88601c7ed41cd3c0bb0e35d178a1e3 Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Wed, 5 Aug 2020 16:16:08 -0500 Subject: [PATCH 21/25] fix ILM tests --- .../xpack/TimeSeriesRestDriver.java | 4 +- .../xpack/ilm/ChangePolicyforIndexIT.java | 8 +- .../xpack/ilm/TimeSeriesDataStreamsIT.java | 95 ++++++++++--------- .../ilm/TimeSeriesLifecycleActionsIT.java | 10 +- 4 files changed, 62 insertions(+), 55 deletions(-) diff --git a/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/TimeSeriesRestDriver.java b/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/TimeSeriesRestDriver.java index 617524fa48368..15ea717b87e26 100644 --- a/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/TimeSeriesRestDriver.java +++ b/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/TimeSeriesRestDriver.java @@ -152,11 +152,11 @@ public static void createFullPolicy(RestClient client, String policyName, TimeVa Map warmActions = new HashMap<>(); warmActions.put(SetPriorityAction.NAME, new SetPriorityAction(50)); warmActions.put(ForceMergeAction.NAME, new ForceMergeAction(1, null)); - warmActions.put(AllocateAction.NAME, new AllocateAction(1, singletonMap("_name", "integTest-1,integTest-2"), null, null)); + warmActions.put(AllocateAction.NAME, new AllocateAction(1, singletonMap("_name", "javaRestTest-1,javaRestTest-2"), null, null)); warmActions.put(ShrinkAction.NAME, new ShrinkAction(1)); Map coldActions = new HashMap<>(); coldActions.put(SetPriorityAction.NAME, new SetPriorityAction(0)); - coldActions.put(AllocateAction.NAME, new AllocateAction(0, singletonMap("_name", "integTest-3"), null, null)); + coldActions.put(AllocateAction.NAME, new AllocateAction(0, singletonMap("_name", "javaRestTest-3"), null, null)); Map phases = new HashMap<>(); phases.put("hot", new Phase("hot", hotTime, hotActions)); phases.put("warm", new Phase("warm", TimeValue.ZERO, warmActions)); diff --git a/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/ChangePolicyforIndexIT.java b/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/ChangePolicyforIndexIT.java index 76443b5257a31..963a86d3693c9 100644 --- a/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/ChangePolicyforIndexIT.java +++ b/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/ChangePolicyforIndexIT.java @@ -64,7 +64,7 @@ public void testChangePolicyForIndex() throws Exception { Map phases2 = new HashMap<>(); phases2.put("hot", new Phase("hot", TimeValue.ZERO, singletonMap(RolloverAction.NAME, new RolloverAction(null, null, 1000L)))); phases2.put("warm", new Phase("warm", TimeValue.ZERO, - singletonMap(AllocateAction.NAME, new AllocateAction(1, singletonMap("_name", "integTest-1,integTest-2"), null, null)))); + singletonMap(AllocateAction.NAME, new AllocateAction(1, singletonMap("_name", "javaRestTest-1,javaRestTest-2"), null, null)))); LifecyclePolicy lifecyclePolicy2 = new LifecyclePolicy("policy_1", phases2); // PUT policy_1 and policy_2 XContentBuilder builder1 = jsonBuilder(); @@ -82,7 +82,7 @@ public void testChangePolicyForIndex() throws Exception { // create the test-index index and set the policy to policy_1 Settings settings = Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 4) - .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0).put("index.routing.allocation.include._name", "integTest-0") + .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0).put("index.routing.allocation.include._name", "javaRestTest-0") .put(RolloverAction.LIFECYCLE_ROLLOVER_ALIAS, "alias").put(LifecycleSettings.LIFECYCLE_NAME, "policy_1").build(); Request createIndexRequest = new Request("PUT", "/" + indexName); createIndexRequest.setJsonEntity( @@ -115,10 +115,10 @@ public void testChangePolicyForIndex() throws Exception { // Check the index goes to the warm phase and completes assertBusy(() -> assertStep(indexName, PhaseCompleteStep.finalStep("warm").getKey()), 30, TimeUnit.SECONDS); - // Check index is allocated on integTest-1 and integTest-2 as per policy_2 + // Check index is allocated on javaRestTest-1 and javaRestTest-2 as per policy_2 Map indexSettings = getIndexSettingsAsMap(indexName); String includesAllocation = (String) indexSettings.get("index.routing.allocation.include._name"); - assertEquals("integTest-1,integTest-2", includesAllocation); + assertEquals("javaRestTest-1,javaRestTest-2", includesAllocation); } private void assertStep(String indexName, StepKey expectedStep) throws IOException { diff --git a/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesDataStreamsIT.java b/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesDataStreamsIT.java index 0fc800ed674f0..e5cd67ae528b8 100644 --- a/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesDataStreamsIT.java +++ b/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesDataStreamsIT.java @@ -17,7 +17,6 @@ import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.index.IndexSettings; import org.elasticsearch.test.rest.ESRestTestCase; -import org.elasticsearch.xpack.TimeSeriesRestDriver; import org.elasticsearch.xpack.core.ilm.CheckNotDataStreamWriteIndexStep; import org.elasticsearch.xpack.core.ilm.ForceMergeAction; import org.elasticsearch.xpack.core.ilm.FreezeAction; @@ -27,7 +26,6 @@ import org.elasticsearch.xpack.core.ilm.RolloverAction; import org.elasticsearch.xpack.core.ilm.SearchableSnapshotAction; import org.elasticsearch.xpack.core.ilm.ShrinkAction; -import org.hamcrest.Matchers; import java.io.IOException; import java.io.InputStream; @@ -35,6 +33,15 @@ import java.util.Map; import java.util.concurrent.TimeUnit; +import static org.elasticsearch.xpack.TimeSeriesRestDriver.createComposableTemplate; +import static org.elasticsearch.xpack.TimeSeriesRestDriver.createFullPolicy; +import static org.elasticsearch.xpack.TimeSeriesRestDriver.createNewSingletonPolicy; +import static org.elasticsearch.xpack.TimeSeriesRestDriver.createSnapshotRepo; +import static org.elasticsearch.xpack.TimeSeriesRestDriver.explainIndex; +import static org.elasticsearch.xpack.TimeSeriesRestDriver.getOnlyIndexSettings; +import static org.elasticsearch.xpack.TimeSeriesRestDriver.getStepKeyForIndex; +import static org.elasticsearch.xpack.TimeSeriesRestDriver.indexDocument; +import static org.elasticsearch.xpack.TimeSeriesRestDriver.rolloverMaxOneDocCondition; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; @@ -42,51 +49,51 @@ public class TimeSeriesDataStreamsIT extends ESRestTestCase { public void testRolloverAction() throws Exception { String policyName = "logs-policy"; - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policyName, "hot", new RolloverAction(null, null, 1L)); + createNewSingletonPolicy(client(), policyName, "hot", new RolloverAction(null, null, 1L)); - TimeSeriesRestDriver.createComposableTemplate(client(), "logs-template", "logs-foo*", getTemplate(policyName)); + createComposableTemplate(client(), "logs-template", "logs-foo*", getTemplate(policyName)); String dataStream = "logs-foo"; - TimeSeriesRestDriver.indexDocument(client(), dataStream, true); + indexDocument(client(), dataStream, true); assertBusy(() -> assertTrue(indexExists(DataStream.getDefaultBackingIndexName(dataStream, 2)))); assertBusy(() -> assertTrue(Boolean.parseBoolean((String) getIndexSettingsAsMap( DataStream.getDefaultBackingIndexName(dataStream, 2)).get("index.hidden")))); - assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), DataStream.getDefaultBackingIndexName(dataStream, 1)), + assertBusy(() -> assertThat(getStepKeyForIndex(client(), DataStream.getDefaultBackingIndexName(dataStream, 1)), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); } public void testShrinkActionInPolicyWithoutHotPhase() throws Exception { String policyName = "logs-policy"; - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policyName, "warm", new ShrinkAction(1)); + createNewSingletonPolicy(client(), policyName, "warm", new ShrinkAction(1)); - TimeSeriesRestDriver.createComposableTemplate(client(), "logs-template", "logs-foo*", getTemplate(policyName)); + createComposableTemplate(client(), "logs-template", "logs-foo*", getTemplate(policyName)); String dataStream = "logs-foo"; - TimeSeriesRestDriver.indexDocument(client(), dataStream, true); + indexDocument(client(), dataStream, true); String backingIndexName = DataStream.getDefaultBackingIndexName(dataStream, 1); String shrunkenIndex = ShrinkAction.SHRUNKEN_INDEX_PREFIX + backingIndexName; assertBusy(() -> assertThat( "original index must wait in the " + CheckNotDataStreamWriteIndexStep.NAME + " until it is not the write index anymore", - TimeSeriesRestDriver.explainIndex(client(), backingIndexName).get("step"), Matchers.is(CheckNotDataStreamWriteIndexStep.NAME)), 30, TimeUnit.SECONDS); + explainIndex(client(), backingIndexName).get("step"), is(CheckNotDataStreamWriteIndexStep.NAME)), 30, TimeUnit.SECONDS); // Manual rollover the original index such that it's not the write index in the data stream anymore - TimeSeriesRestDriver.rolloverMaxOneDocCondition(client(), dataStream); + rolloverMaxOneDocCondition(client(), dataStream); assertBusy(() -> assertTrue(indexExists(shrunkenIndex)), 30, TimeUnit.SECONDS); - assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), shrunkenIndex), equalTo(PhaseCompleteStep.finalStep("warm").getKey()))); + assertBusy(() -> assertThat(getStepKeyForIndex(client(), shrunkenIndex), equalTo(PhaseCompleteStep.finalStep("warm").getKey()))); assertBusy(() -> assertThat("the original index must've been deleted", indexExists(backingIndexName), is(false))); } public void testShrinkAfterRollover() throws Exception { String policyName = "logs-policy"; - TimeSeriesRestDriver.createFullPolicy(client(), policyName, TimeValue.ZERO); + createFullPolicy(client(), policyName, TimeValue.ZERO); - TimeSeriesRestDriver.createComposableTemplate(client(), "logs-template", "logs-foo*", getTemplate(policyName)); + createComposableTemplate(client(), "logs-template", "logs-foo*", getTemplate(policyName)); String dataStream = "logs-foo"; - TimeSeriesRestDriver.indexDocument(client(), dataStream, true); + indexDocument(client(), dataStream, true); String backingIndexName = DataStream.getDefaultBackingIndexName(dataStream, 1); String rolloverIndex = DataStream.getDefaultBackingIndexName(dataStream, 2); @@ -100,75 +107,75 @@ public void testShrinkAfterRollover() throws Exception { public void testSearchableSnapshotAction() throws Exception { String snapshotRepo = randomAlphaOfLengthBetween(5, 10); - TimeSeriesRestDriver.createSnapshotRepo(client(), snapshotRepo, randomBoolean()); + createSnapshotRepo(client(), snapshotRepo, randomBoolean()); String policyName = "logs-policy"; - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policyName, "cold", new SearchableSnapshotAction(snapshotRepo)); + createNewSingletonPolicy(client(), policyName, "cold", new SearchableSnapshotAction(snapshotRepo)); - TimeSeriesRestDriver.createComposableTemplate(client(), "logs-template", "logs-foo*", getTemplate(policyName)); + createComposableTemplate(client(), "logs-template", "logs-foo*", getTemplate(policyName)); String dataStream = "logs-foo"; - TimeSeriesRestDriver.indexDocument(client(), dataStream, true); + indexDocument(client(), dataStream, true); String backingIndexName = DataStream.getDefaultBackingIndexName(dataStream, 1); String restoredIndexName = SearchableSnapshotAction.RESTORED_INDEX_PREFIX + backingIndexName; assertBusy(() -> assertThat( "original index must wait in the " + CheckNotDataStreamWriteIndexStep.NAME + " until it is not the write index anymore", - TimeSeriesRestDriver.explainIndex(client(), backingIndexName).get("step"), Matchers.is(CheckNotDataStreamWriteIndexStep.NAME)), + explainIndex(client(), backingIndexName).get("step"), is(CheckNotDataStreamWriteIndexStep.NAME)), 30, TimeUnit.SECONDS); // Manual rollover the original index such that it's not the write index in the data stream anymore - TimeSeriesRestDriver.rolloverMaxOneDocCondition(client(), dataStream); + rolloverMaxOneDocCondition(client(), dataStream); assertBusy(() -> assertThat(indexExists(restoredIndexName), is(true))); assertBusy(() -> assertFalse(indexExists(backingIndexName)), 60, TimeUnit.SECONDS); - assertBusy(() -> assertThat(TimeSeriesRestDriver.explainIndex(client(), restoredIndexName).get("step"), Matchers.is(PhaseCompleteStep.NAME)), 30, + assertBusy(() -> assertThat(explainIndex(client(), restoredIndexName).get("step"), is(PhaseCompleteStep.NAME)), 30, TimeUnit.SECONDS); } public void testReadOnlyAction() throws Exception { String policyName = "logs-policy"; - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policyName, "warm", new ReadOnlyAction()); + createNewSingletonPolicy(client(), policyName, "warm", new ReadOnlyAction()); - TimeSeriesRestDriver.createComposableTemplate(client(), "logs-template", "logs-foo*", getTemplate(policyName)); + createComposableTemplate(client(), "logs-template", "logs-foo*", getTemplate(policyName)); String dataStream = "logs-foo"; - TimeSeriesRestDriver.indexDocument(client(), dataStream, true); + indexDocument(client(), dataStream, true); String backingIndexName = DataStream.getDefaultBackingIndexName(dataStream, 1); assertBusy(() -> assertThat( "index must wait in the " + CheckNotDataStreamWriteIndexStep.NAME + " until it is not the write index anymore", - TimeSeriesRestDriver.explainIndex(client(), backingIndexName).get("step"), Matchers.is(CheckNotDataStreamWriteIndexStep.NAME)), + explainIndex(client(), backingIndexName).get("step"), is(CheckNotDataStreamWriteIndexStep.NAME)), 30, TimeUnit.SECONDS); // Manual rollover the original index such that it's not the write index in the data stream anymore - TimeSeriesRestDriver.rolloverMaxOneDocCondition(client(), dataStream); + rolloverMaxOneDocCondition(client(), dataStream); - assertBusy(() -> assertThat(TimeSeriesRestDriver.explainIndex(client(), backingIndexName).get("step"), Matchers.is(PhaseCompleteStep.NAME)), 30, + assertBusy(() -> assertThat(explainIndex(client(), backingIndexName).get("step"), is(PhaseCompleteStep.NAME)), 30, TimeUnit.SECONDS); - assertThat(TimeSeriesRestDriver.getOnlyIndexSettings(client(), backingIndexName).get(IndexMetadata.INDEX_BLOCKS_WRITE_SETTING.getKey()), + assertThat(getOnlyIndexSettings(client(), backingIndexName).get(IndexMetadata.INDEX_BLOCKS_WRITE_SETTING.getKey()), equalTo("true")); } public void testFreezeAction() throws Exception { String policyName = "logs-policy"; - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policyName, "cold", new FreezeAction()); + createNewSingletonPolicy(client(), policyName, "cold", new FreezeAction()); - TimeSeriesRestDriver.createComposableTemplate(client(), "logs-template", "logs-foo*", getTemplate(policyName)); + createComposableTemplate(client(), "logs-template", "logs-foo*", getTemplate(policyName)); String dataStream = "logs-foo"; - TimeSeriesRestDriver.indexDocument(client(), dataStream, true); + indexDocument(client(), dataStream, true); String backingIndexName = DataStream.getDefaultBackingIndexName(dataStream, 1); assertBusy(() -> assertThat( "index must wait in the " + CheckNotDataStreamWriteIndexStep.NAME + " until it is not the write index anymore", - TimeSeriesRestDriver.explainIndex(client(), backingIndexName).get("step"), Matchers.is(CheckNotDataStreamWriteIndexStep.NAME)), + explainIndex(client(), backingIndexName).get("step"), is(CheckNotDataStreamWriteIndexStep.NAME)), 30, TimeUnit.SECONDS); // Manual rollover the original index such that it's not the write index in the data stream anymore - TimeSeriesRestDriver.rolloverMaxOneDocCondition(client(), dataStream); + rolloverMaxOneDocCondition(client(), dataStream); - assertBusy(() -> assertThat(TimeSeriesRestDriver.explainIndex(client(), backingIndexName).get("step"), Matchers.is(PhaseCompleteStep.NAME)), 30, + assertBusy(() -> assertThat(explainIndex(client(), backingIndexName).get("step"), is(PhaseCompleteStep.NAME)), 30, TimeUnit.SECONDS); - Map settings = TimeSeriesRestDriver.getOnlyIndexSettings(client(), backingIndexName); + Map settings = getOnlyIndexSettings(client(), backingIndexName); assertThat(settings.get(IndexMetadata.SETTING_BLOCKS_WRITE), equalTo("true")); assertThat(settings.get(IndexSettings.INDEX_SEARCH_THROTTLED.getKey()), equalTo("true")); assertThat(settings.get("index.frozen"), equalTo("true")); @@ -176,31 +183,31 @@ public void testFreezeAction() throws Exception { public void testForceMergeAction() throws Exception { String policyName = "logs-policy"; - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policyName, "warm", new ForceMergeAction(1, null)); + createNewSingletonPolicy(client(), policyName, "warm", new ForceMergeAction(1, null)); - TimeSeriesRestDriver.createComposableTemplate(client(), "logs-template", "logs-foo*", getTemplate(policyName)); + createComposableTemplate(client(), "logs-template", "logs-foo*", getTemplate(policyName)); String dataStream = "logs-foo"; - TimeSeriesRestDriver.indexDocument(client(), dataStream, true); + indexDocument(client(), dataStream, true); String backingIndexName = DataStream.getDefaultBackingIndexName(dataStream, 1); assertBusy(() -> assertThat( "index must wait in the " + CheckNotDataStreamWriteIndexStep.NAME + " until it is not the write index anymore", - TimeSeriesRestDriver.explainIndex(client(), backingIndexName).get("step"), Matchers.is(CheckNotDataStreamWriteIndexStep.NAME)), + explainIndex(client(), backingIndexName).get("step"), is(CheckNotDataStreamWriteIndexStep.NAME)), 30, TimeUnit.SECONDS); // Manual rollover the original index such that it's not the write index in the data stream anymore - TimeSeriesRestDriver.rolloverMaxOneDocCondition(client(), dataStream); + rolloverMaxOneDocCondition(client(), dataStream); - assertBusy(() -> assertThat(TimeSeriesRestDriver.explainIndex(client(), backingIndexName).get("step"), Matchers.is(PhaseCompleteStep.NAME)), 30, + assertBusy(() -> assertThat(explainIndex(client(), backingIndexName).get("step"), is(PhaseCompleteStep.NAME)), 30, TimeUnit.SECONDS); } @SuppressWarnings("unchecked") public void testGetDataStreamReturnsILMPolicy() throws Exception { String policyName = "logs-policy"; - TimeSeriesRestDriver.createComposableTemplate(client(), "logs-template", "logs-foo*", getTemplate(policyName)); + createComposableTemplate(client(), "logs-template", "logs-foo*", getTemplate(policyName)); String dataStream = "logs-foo"; - TimeSeriesRestDriver.indexDocument(client(), dataStream, true); + indexDocument(client(), dataStream, true); Request explainRequest = new Request("GET", "/_data_stream/logs-foo"); Response response = client().performRequest(explainRequest); diff --git a/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java b/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java index 60982a7e0bec9..168def2165d73 100644 --- a/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java +++ b/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java @@ -107,7 +107,7 @@ public void testFullPolicy() throws Exception { String secondIndex = index + "-000002"; createIndexWithSettings(originalIndex, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 4) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) - .put("index.routing.allocation.include._name", "integTest-0") + .put("index.routing.allocation.include._name", "javaRestTest-0") .put(RolloverAction.LIFECYCLE_ROLLOVER_ALIAS, alias)); // create policy @@ -135,7 +135,7 @@ public void testMoveToAllocateStep() throws Exception { String originalIndex = index + "-000001"; createIndexWithSettings(originalIndex, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 4) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) - .put("index.routing.allocation.include._name", "integTest-0") + .put("index.routing.allocation.include._name", "javaRestTest-0") .put(RolloverAction.LIFECYCLE_ROLLOVER_ALIAS, "alias")); // create policy @@ -169,7 +169,7 @@ public void testMoveToRolloverStep() throws Exception { String secondIndex = index + "-000002"; createIndexWithSettings(originalIndex, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 4) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) - .put("index.routing.allocation.include._name", "integTest-0") + .put("index.routing.allocation.include._name", "javaRestTest-0") .put(RolloverAction.LIFECYCLE_ROLLOVER_ALIAS, alias)); TimeSeriesRestDriver.createFullPolicy(client(), policy, TimeValue.timeValueHours(10)); @@ -346,7 +346,7 @@ public void testRolloverActionWithIndexingComplete() throws Exception { public void testAllocateOnlyAllocation() throws Exception { createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 2) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)); - String allocateNodeName = "integTest-" + randomFrom(0, 1); + String allocateNodeName = "javaRestTest-" + randomFrom(0, 1); AllocateAction allocateAction = new AllocateAction(null, null, null, singletonMap("_name", allocateNodeName)); String endPhase = randomFrom("warm", "cold"); TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, endPhase, allocateAction); @@ -621,7 +621,7 @@ public void testShrinkDuringSnapshot() throws Exception { .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 2) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) // required so the shrink doesn't wait on SetSingleNodeAllocateStep - .put(IndexMetadata.INDEX_ROUTING_REQUIRE_GROUP_SETTING.getKey() + "_name", "integTest-0")); + .put(IndexMetadata.INDEX_ROUTING_REQUIRE_GROUP_SETTING.getKey() + "_name", "javaRestTest-0")); // index document so snapshot actually does something TimeSeriesRestDriver.indexDocument(client(), index); // start snapshot From 29bb22fdf3587214833b1c3486297179e473a933 Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Mon, 24 Aug 2020 14:02:36 -0500 Subject: [PATCH 22/25] preserve main source set --- x-pack/plugin/enrich/qa/common/build.gradle | 14 -------------- .../test/enrich/CommonEnrichRestTestCase.java | 0 .../enrich/qa/rest-with-security/build.gradle | 2 +- x-pack/plugin/enrich/qa/rest/build.gradle | 2 +- x-pack/plugin/eql/qa/common/build.gradle | 14 -------------- .../test/eql/CommonEqlActionTestCase.java | 0 .../test/eql/CommonEqlRestTestCase.java | 0 .../org/elasticsearch/test/eql/DataLoader.java | 0 .../java/org/elasticsearch/test/eql/EqlSpec.java | 0 .../org/elasticsearch/test/eql/EqlSpecLoader.java | 0 .../test/eql/stats/FeatureMetric.java | 0 .../test/eql/stats/RestEqlUsageTestCase.java | 0 .../resources/additional_test_queries.toml | 0 .../{test => main}/resources/mapping-default.json | 0 .../src/{test => main}/resources/test_data.json | 0 .../src/{test => main}/resources/test_queries.toml | 0 .../resources/test_queries_unsupported.toml | 0 x-pack/plugin/eql/qa/rest/build.gradle | 2 +- 18 files changed, 3 insertions(+), 31 deletions(-) rename x-pack/plugin/enrich/qa/common/src/{test => main}/java/org/elasticsearch/test/enrich/CommonEnrichRestTestCase.java (100%) rename x-pack/plugin/eql/qa/common/src/{test => main}/java/org/elasticsearch/test/eql/CommonEqlActionTestCase.java (100%) rename x-pack/plugin/eql/qa/common/src/{test => main}/java/org/elasticsearch/test/eql/CommonEqlRestTestCase.java (100%) rename x-pack/plugin/eql/qa/common/src/{test => main}/java/org/elasticsearch/test/eql/DataLoader.java (100%) rename x-pack/plugin/eql/qa/common/src/{test => main}/java/org/elasticsearch/test/eql/EqlSpec.java (100%) rename x-pack/plugin/eql/qa/common/src/{test => main}/java/org/elasticsearch/test/eql/EqlSpecLoader.java (100%) rename x-pack/plugin/eql/qa/common/src/{test => main}/java/org/elasticsearch/test/eql/stats/FeatureMetric.java (100%) rename x-pack/plugin/eql/qa/common/src/{test => main}/java/org/elasticsearch/test/eql/stats/RestEqlUsageTestCase.java (100%) rename x-pack/plugin/eql/qa/common/src/{test => main}/resources/additional_test_queries.toml (100%) rename x-pack/plugin/eql/qa/common/src/{test => main}/resources/mapping-default.json (100%) rename x-pack/plugin/eql/qa/common/src/{test => main}/resources/test_data.json (100%) rename x-pack/plugin/eql/qa/common/src/{test => main}/resources/test_queries.toml (100%) rename x-pack/plugin/eql/qa/common/src/{test => main}/resources/test_queries_unsupported.toml (100%) diff --git a/x-pack/plugin/enrich/qa/common/build.gradle b/x-pack/plugin/enrich/qa/common/build.gradle index caeb625926b8a..53a1915bb2a07 100644 --- a/x-pack/plugin/enrich/qa/common/build.gradle +++ b/x-pack/plugin/enrich/qa/common/build.gradle @@ -4,17 +4,3 @@ test.enabled = false dependencies { api project(':test:framework') } - -configurations { - testArtifacts.extendsFrom testRuntime - testArtifacts.extendsFrom testImplementation -} - -def testJar = tasks.register("testJar", Jar) { - appendix 'test' - from sourceSets.test.output -} - -artifacts { - testArtifacts testJar -} diff --git a/x-pack/plugin/enrich/qa/common/src/test/java/org/elasticsearch/test/enrich/CommonEnrichRestTestCase.java b/x-pack/plugin/enrich/qa/common/src/main/java/org/elasticsearch/test/enrich/CommonEnrichRestTestCase.java similarity index 100% rename from x-pack/plugin/enrich/qa/common/src/test/java/org/elasticsearch/test/enrich/CommonEnrichRestTestCase.java rename to x-pack/plugin/enrich/qa/common/src/main/java/org/elasticsearch/test/enrich/CommonEnrichRestTestCase.java diff --git a/x-pack/plugin/enrich/qa/rest-with-security/build.gradle b/x-pack/plugin/enrich/qa/rest-with-security/build.gradle index 656bb20bccd16..6b091d3fa64aa 100644 --- a/x-pack/plugin/enrich/qa/rest-with-security/build.gradle +++ b/x-pack/plugin/enrich/qa/rest-with-security/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'elasticsearch.java-rest-test' dependencies { javaRestTestImplementation project(path: xpackModule('core')) - javaRestTestImplementation project(path: xpackModule('enrich:qa:common'), configuration: 'testArtifacts') + javaRestTestImplementation project(path: xpackModule('enrich:qa:common')) } testClusters.all { diff --git a/x-pack/plugin/enrich/qa/rest/build.gradle b/x-pack/plugin/enrich/qa/rest/build.gradle index 7faadb01f5e3f..cac82efd43003 100644 --- a/x-pack/plugin/enrich/qa/rest/build.gradle +++ b/x-pack/plugin/enrich/qa/rest/build.gradle @@ -9,7 +9,7 @@ restResources { } dependencies { - javaRestTestImplementation project(path: xpackModule('enrich:qa:common'), configuration: 'testArtifacts') + javaRestTestImplementation project(path: xpackModule('enrich:qa:common')) } testClusters.all { diff --git a/x-pack/plugin/eql/qa/common/build.gradle b/x-pack/plugin/eql/qa/common/build.gradle index 1b45c82557a24..d41a69643bab7 100644 --- a/x-pack/plugin/eql/qa/common/build.gradle +++ b/x-pack/plugin/eql/qa/common/build.gradle @@ -9,17 +9,3 @@ dependencies { // TOML parser for EqlActionIT tests api 'io.ous:jtoml:2.0.0' } - -configurations { - testArtifacts.extendsFrom testRuntime - testArtifacts.extendsFrom testImplementation -} - -def testJar = tasks.register("testJar", Jar) { - appendix 'test' - from sourceSets.test.output -} - -artifacts { - testArtifacts testJar -} diff --git a/x-pack/plugin/eql/qa/common/src/test/java/org/elasticsearch/test/eql/CommonEqlActionTestCase.java b/x-pack/plugin/eql/qa/common/src/main/java/org/elasticsearch/test/eql/CommonEqlActionTestCase.java similarity index 100% rename from x-pack/plugin/eql/qa/common/src/test/java/org/elasticsearch/test/eql/CommonEqlActionTestCase.java rename to x-pack/plugin/eql/qa/common/src/main/java/org/elasticsearch/test/eql/CommonEqlActionTestCase.java diff --git a/x-pack/plugin/eql/qa/common/src/test/java/org/elasticsearch/test/eql/CommonEqlRestTestCase.java b/x-pack/plugin/eql/qa/common/src/main/java/org/elasticsearch/test/eql/CommonEqlRestTestCase.java similarity index 100% rename from x-pack/plugin/eql/qa/common/src/test/java/org/elasticsearch/test/eql/CommonEqlRestTestCase.java rename to x-pack/plugin/eql/qa/common/src/main/java/org/elasticsearch/test/eql/CommonEqlRestTestCase.java diff --git a/x-pack/plugin/eql/qa/common/src/test/java/org/elasticsearch/test/eql/DataLoader.java b/x-pack/plugin/eql/qa/common/src/main/java/org/elasticsearch/test/eql/DataLoader.java similarity index 100% rename from x-pack/plugin/eql/qa/common/src/test/java/org/elasticsearch/test/eql/DataLoader.java rename to x-pack/plugin/eql/qa/common/src/main/java/org/elasticsearch/test/eql/DataLoader.java diff --git a/x-pack/plugin/eql/qa/common/src/test/java/org/elasticsearch/test/eql/EqlSpec.java b/x-pack/plugin/eql/qa/common/src/main/java/org/elasticsearch/test/eql/EqlSpec.java similarity index 100% rename from x-pack/plugin/eql/qa/common/src/test/java/org/elasticsearch/test/eql/EqlSpec.java rename to x-pack/plugin/eql/qa/common/src/main/java/org/elasticsearch/test/eql/EqlSpec.java diff --git a/x-pack/plugin/eql/qa/common/src/test/java/org/elasticsearch/test/eql/EqlSpecLoader.java b/x-pack/plugin/eql/qa/common/src/main/java/org/elasticsearch/test/eql/EqlSpecLoader.java similarity index 100% rename from x-pack/plugin/eql/qa/common/src/test/java/org/elasticsearch/test/eql/EqlSpecLoader.java rename to x-pack/plugin/eql/qa/common/src/main/java/org/elasticsearch/test/eql/EqlSpecLoader.java diff --git a/x-pack/plugin/eql/qa/common/src/test/java/org/elasticsearch/test/eql/stats/FeatureMetric.java b/x-pack/plugin/eql/qa/common/src/main/java/org/elasticsearch/test/eql/stats/FeatureMetric.java similarity index 100% rename from x-pack/plugin/eql/qa/common/src/test/java/org/elasticsearch/test/eql/stats/FeatureMetric.java rename to x-pack/plugin/eql/qa/common/src/main/java/org/elasticsearch/test/eql/stats/FeatureMetric.java diff --git a/x-pack/plugin/eql/qa/common/src/test/java/org/elasticsearch/test/eql/stats/RestEqlUsageTestCase.java b/x-pack/plugin/eql/qa/common/src/main/java/org/elasticsearch/test/eql/stats/RestEqlUsageTestCase.java similarity index 100% rename from x-pack/plugin/eql/qa/common/src/test/java/org/elasticsearch/test/eql/stats/RestEqlUsageTestCase.java rename to x-pack/plugin/eql/qa/common/src/main/java/org/elasticsearch/test/eql/stats/RestEqlUsageTestCase.java diff --git a/x-pack/plugin/eql/qa/common/src/test/resources/additional_test_queries.toml b/x-pack/plugin/eql/qa/common/src/main/resources/additional_test_queries.toml similarity index 100% rename from x-pack/plugin/eql/qa/common/src/test/resources/additional_test_queries.toml rename to x-pack/plugin/eql/qa/common/src/main/resources/additional_test_queries.toml diff --git a/x-pack/plugin/eql/qa/common/src/test/resources/mapping-default.json b/x-pack/plugin/eql/qa/common/src/main/resources/mapping-default.json similarity index 100% rename from x-pack/plugin/eql/qa/common/src/test/resources/mapping-default.json rename to x-pack/plugin/eql/qa/common/src/main/resources/mapping-default.json diff --git a/x-pack/plugin/eql/qa/common/src/test/resources/test_data.json b/x-pack/plugin/eql/qa/common/src/main/resources/test_data.json similarity index 100% rename from x-pack/plugin/eql/qa/common/src/test/resources/test_data.json rename to x-pack/plugin/eql/qa/common/src/main/resources/test_data.json diff --git a/x-pack/plugin/eql/qa/common/src/test/resources/test_queries.toml b/x-pack/plugin/eql/qa/common/src/main/resources/test_queries.toml similarity index 100% rename from x-pack/plugin/eql/qa/common/src/test/resources/test_queries.toml rename to x-pack/plugin/eql/qa/common/src/main/resources/test_queries.toml diff --git a/x-pack/plugin/eql/qa/common/src/test/resources/test_queries_unsupported.toml b/x-pack/plugin/eql/qa/common/src/main/resources/test_queries_unsupported.toml similarity index 100% rename from x-pack/plugin/eql/qa/common/src/test/resources/test_queries_unsupported.toml rename to x-pack/plugin/eql/qa/common/src/main/resources/test_queries_unsupported.toml diff --git a/x-pack/plugin/eql/qa/rest/build.gradle b/x-pack/plugin/eql/qa/rest/build.gradle index 9084e70ac5088..041015b6b6547 100644 --- a/x-pack/plugin/eql/qa/rest/build.gradle +++ b/x-pack/plugin/eql/qa/rest/build.gradle @@ -9,7 +9,7 @@ restResources { } dependencies { - javaRestTestImplementation project(path: xpackModule('eql:qa:common'), configuration: 'testArtifacts') + javaRestTestImplementation project(path: xpackModule('eql:qa:common')) } testClusters.all { From 9ec969b4079e91d0b85cbbdb602c5fa017d32165 Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Tue, 1 Sep 2020 12:09:20 -0500 Subject: [PATCH 23/25] fix merge --- .../ilm/TimeSeriesLifecycleActionsIT.java | 517 ++++++++---------- 1 file changed, 214 insertions(+), 303 deletions(-) diff --git a/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java b/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java index 968b455051988..c202894d7ccd7 100644 --- a/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java +++ b/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java @@ -8,7 +8,6 @@ import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; -import org.apache.http.util.EntityUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.elasticsearch.client.Request; @@ -28,6 +27,7 @@ import org.elasticsearch.index.IndexSettings; import org.elasticsearch.snapshots.SnapshotState; import org.elasticsearch.test.rest.ESRestTestCase; +import org.elasticsearch.xpack.cluster.routing.allocation.DataTierAllocationDecider; import org.elasticsearch.xpack.core.ilm.AllocateAction; import org.elasticsearch.xpack.core.ilm.DeleteAction; import org.elasticsearch.xpack.core.ilm.ForceMergeAction; @@ -62,10 +62,20 @@ import java.util.Locale; import java.util.Map; import java.util.concurrent.TimeUnit; -import java.util.function.Supplier; import static java.util.Collections.singletonMap; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; +import static org.elasticsearch.xpack.TimeSeriesRestDriver.createFullPolicy; +import static org.elasticsearch.xpack.TimeSeriesRestDriver.createIndexWithSettings; +import static org.elasticsearch.xpack.TimeSeriesRestDriver.createNewSingletonPolicy; +import static org.elasticsearch.xpack.TimeSeriesRestDriver.createSnapshotRepo; +import static org.elasticsearch.xpack.TimeSeriesRestDriver.explain; +import static org.elasticsearch.xpack.TimeSeriesRestDriver.explainIndex; +import static org.elasticsearch.xpack.TimeSeriesRestDriver.getNumberOfSegments; +import static org.elasticsearch.xpack.TimeSeriesRestDriver.getOnlyIndexSettings; +import static org.elasticsearch.xpack.TimeSeriesRestDriver.getStepKeyForIndex; +import static org.elasticsearch.xpack.TimeSeriesRestDriver.indexDocument; +import static org.elasticsearch.xpack.TimeSeriesRestDriver.rolloverMaxOneDocCondition; import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; @@ -95,7 +105,7 @@ public void refreshIndex() { public static void updatePolicy(String indexName, String policy) throws IOException { Request changePolicyRequest = new Request("PUT", "/" + indexName + "/_settings"); final StringEntity changePolicyEntity = new StringEntity("{ \"index.lifecycle.name\": \"" + policy + "\" }", - ContentType.APPLICATION_JSON); + ContentType.APPLICATION_JSON); changePolicyRequest.setEntity(changePolicyEntity); assertOK(client().performRequest(changePolicyRequest)); } @@ -104,13 +114,13 @@ public void testFullPolicy() throws Exception { String originalIndex = index + "-000001"; String shrunkenOriginalIndex = ShrinkAction.SHRUNKEN_INDEX_PREFIX + originalIndex; String secondIndex = index + "-000002"; - createIndexWithSettings(originalIndex, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 4) + createIndexWithSettings(client(), originalIndex, alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 4) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) - .put("index.routing.allocation.include._name", "javaRestTest-0") + .put("index.routing.allocation.include._name", "integTest-0") .put(RolloverAction.LIFECYCLE_ROLLOVER_ALIAS, alias)); // create policy - TimeSeriesRestDriver.createFullPolicy(client(), policy, TimeValue.ZERO); + createFullPolicy(client(), policy, TimeValue.ZERO); // update policy on index updatePolicy(originalIndex, policy); // index document {"foo": "bar"} to trigger rollover @@ -132,19 +142,19 @@ public void testFullPolicy() throws Exception { public void testMoveToAllocateStep() throws Exception { String originalIndex = index + "-000001"; - createIndexWithSettings(originalIndex, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 4) + createIndexWithSettings(client(), originalIndex, alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 4) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) - .put("index.routing.allocation.include._name", "javaRestTest-0") + .put("index.routing.allocation.include._name", "integTest-0") .put(RolloverAction.LIFECYCLE_ROLLOVER_ALIAS, "alias")); // create policy - TimeSeriesRestDriver.createFullPolicy(client(), policy, TimeValue.timeValueHours(10)); + createFullPolicy(client(), policy, TimeValue.timeValueHours(10)); // update policy on index updatePolicy(originalIndex, policy); // move to a step Request moveToStepRequest = new Request("POST", "_ilm/move/" + originalIndex); - assertBusy(() -> assertTrue(TimeSeriesRestDriver.getStepKeyForIndex(client(), originalIndex).equals(new StepKey("new", "complete", "complete")))); + assertBusy(() -> assertTrue(getStepKeyForIndex(client(), originalIndex).equals(new StepKey("new", "complete", "complete")))); moveToStepRequest.setJsonEntity("{\n" + " \"current_step\": {\n" + " \"phase\": \"new\",\n" + @@ -166,12 +176,12 @@ public void testMoveToRolloverStep() throws Exception { String originalIndex = index + "-000001"; String shrunkenOriginalIndex = ShrinkAction.SHRUNKEN_INDEX_PREFIX + originalIndex; String secondIndex = index + "-000002"; - createIndexWithSettings(originalIndex, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 4) + createIndexWithSettings(client(), originalIndex, alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 4) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) - .put("index.routing.allocation.include._name", "javaRestTest-0") + .put("index.routing.allocation.include._name", "integTest-0") .put(RolloverAction.LIFECYCLE_ROLLOVER_ALIAS, alias)); - TimeSeriesRestDriver.createFullPolicy(client(), policy, TimeValue.timeValueHours(10)); + createFullPolicy(client(), policy, TimeValue.timeValueHours(10)); // update policy on index updatePolicy(originalIndex, policy); @@ -179,7 +189,7 @@ public void testMoveToRolloverStep() throws Exception { Request moveToStepRequest = new Request("POST", "_ilm/move/" + originalIndex); // index document to trigger rollover index(client(), originalIndex, "_id", "foo", "bar"); - logger.info(TimeSeriesRestDriver.getStepKeyForIndex(client(), originalIndex)); + logger.info(getStepKeyForIndex(client(), originalIndex)); moveToStepRequest.setJsonEntity("{\n" + " \"current_step\": {\n" + " \"phase\": \"new\",\n" + @@ -209,14 +219,14 @@ public void testMoveToRolloverStep() throws Exception { } public void testRetryFailedDeleteAction() throws Exception { - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "delete", new DeleteAction()); - createIndexWithSettings(index, Settings.builder() + createNewSingletonPolicy(client(), policy, "delete", new DeleteAction()); + createIndexWithSettings(client(), index, alias, Settings.builder() .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) .put(IndexMetadata.SETTING_READ_ONLY, true) .put("index.lifecycle.name", policy)); - assertBusy(() -> assertThat((Integer) TimeSeriesRestDriver.explainIndex(client(), index).get(FAILED_STEP_RETRY_COUNT_FIELD), greaterThanOrEqualTo(1)), + assertBusy(() -> assertThat((Integer) explainIndex(client(), index).get(FAILED_STEP_RETRY_COUNT_FIELD), greaterThanOrEqualTo(1)), 30, TimeUnit.SECONDS); assertTrue(indexExists(index)); @@ -228,23 +238,23 @@ public void testRetryFailedDeleteAction() throws Exception { } public void testRetryFreezeDeleteAction() throws Exception { - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "cold", new FreezeAction()); + createNewSingletonPolicy(client(), policy, "cold", new FreezeAction()); - createIndexWithSettings(index, Settings.builder() + createIndexWithSettings(client(), index, alias, Settings.builder() .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) .put(IndexMetadata.SETTING_READ_ONLY, true) .put("index.lifecycle.name", policy)); - assertBusy(() -> assertThat((Integer) TimeSeriesRestDriver.explainIndex(client(), index).get(FAILED_STEP_RETRY_COUNT_FIELD), greaterThanOrEqualTo(1)), + assertBusy(() -> assertThat((Integer) explainIndex(client(), index).get(FAILED_STEP_RETRY_COUNT_FIELD), greaterThanOrEqualTo(1)), 30, TimeUnit.SECONDS); - assertFalse(TimeSeriesRestDriver.getOnlyIndexSettings(client(), index).containsKey("index.frozen")); + assertFalse(getOnlyIndexSettings(client(), index).containsKey("index.frozen")); Request request = new Request("PUT", index + "/_settings"); request.setJsonEntity("{\"index.blocks.read_only\":false}"); assertOK(client().performRequest(request)); - assertBusy(() -> assertThat(TimeSeriesRestDriver.getOnlyIndexSettings(client(), index).get("index.frozen"), equalTo("true"))); + assertBusy(() -> assertThat(getOnlyIndexSettings(client(), index).get("index.frozen"), equalTo("true"))); } public void testRetryFailedShrinkAction() throws Exception { @@ -252,9 +262,9 @@ public void testRetryFailedShrinkAction() throws Exception { int divisor = randomFrom(2, 4); int expectedFinalShards = numShards / divisor; String shrunkenIndex = ShrinkAction.SHRUNKEN_INDEX_PREFIX + index; - createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, numShards) + createIndexWithSettings(client(), index, alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, numShards) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)); - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "warm", new ShrinkAction(numShards + randomIntBetween(1, numShards))); + createNewSingletonPolicy(client(), policy, "warm", new ShrinkAction(numShards + randomIntBetween(1, numShards))); updatePolicy(index, policy); assertBusy(() -> { String failedStep = getFailedStepForIndex(index); @@ -262,7 +272,7 @@ public void testRetryFailedShrinkAction() throws Exception { }); // update policy to be correct - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "warm", new ShrinkAction(expectedFinalShards)); + createNewSingletonPolicy(client(), policy, "warm", new ShrinkAction(expectedFinalShards)); updatePolicy(index, policy); // retry step @@ -272,25 +282,25 @@ public void testRetryFailedShrinkAction() throws Exception { // assert corrected policy is picked up and index is shrunken assertBusy(() -> assertTrue(indexExists(shrunkenIndex)), 30, TimeUnit.SECONDS); assertBusy(() -> assertTrue(aliasExists(shrunkenIndex, index))); - assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), shrunkenIndex), equalTo(PhaseCompleteStep.finalStep("warm").getKey()))); + assertBusy(() -> assertThat(getStepKeyForIndex(client(), shrunkenIndex), equalTo(PhaseCompleteStep.finalStep("warm").getKey()))); assertBusy(() -> { - Map settings = TimeSeriesRestDriver.getOnlyIndexSettings(client(), shrunkenIndex); + Map settings = getOnlyIndexSettings(client(), shrunkenIndex); assertThat(settings.get(IndexMetadata.SETTING_NUMBER_OF_SHARDS), equalTo(String.valueOf(expectedFinalShards))); assertThat(settings.get(IndexMetadata.INDEX_BLOCKS_WRITE_SETTING.getKey()), equalTo("true")); assertThat(settings.get(IndexMetadata.INDEX_ROUTING_REQUIRE_GROUP_SETTING.getKey() + "_id"), nullValue()); }); - expectThrows(ResponseException.class, () -> TimeSeriesRestDriver.indexDocument(client(), index)); + expectThrows(ResponseException.class, () -> indexDocument(client(), index)); } public void testRolloverAction() throws Exception { String originalIndex = index + "-000001"; String secondIndex = index + "-000002"; - createIndexWithSettings(originalIndex, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) + createIndexWithSettings(client(), originalIndex, alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) .put(RolloverAction.LIFECYCLE_ROLLOVER_ALIAS, alias)); // create policy - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); + createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); // update policy on index updatePolicy(originalIndex, policy); // index document {"foo": "bar"} to trigger rollover @@ -298,13 +308,13 @@ public void testRolloverAction() throws Exception { assertBusy(() -> assertTrue(indexExists(secondIndex))); assertBusy(() -> assertTrue(indexExists(originalIndex))); assertBusy(() -> assertEquals("true", - TimeSeriesRestDriver.getOnlyIndexSettings(client(), originalIndex).get(LifecycleSettings.LIFECYCLE_INDEXING_COMPLETE))); + getOnlyIndexSettings(client(), originalIndex).get(LifecycleSettings.LIFECYCLE_INDEXING_COMPLETE))); } public void testRolloverActionWithIndexingComplete() throws Exception { String originalIndex = index + "-000001"; String secondIndex = index + "-000002"; - createIndexWithSettings(originalIndex, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) + createIndexWithSettings(client(), originalIndex, alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) .put(RolloverAction.LIFECYCLE_ROLLOVER_ALIAS, alias)); @@ -330,28 +340,28 @@ public void testRolloverActionWithIndexingComplete() throws Exception { client().performRequest(updateAliasRequest); // create policy - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); + createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); // update policy on index updatePolicy(originalIndex, policy); // index document {"foo": "bar"} to trigger rollover index(client(), originalIndex, "_id", "foo", "bar"); - assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), originalIndex), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); + assertBusy(() -> assertThat(getStepKeyForIndex(client(), originalIndex), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); assertBusy(() -> assertTrue(indexExists(originalIndex))); assertBusy(() -> assertFalse(indexExists(secondIndex))); assertBusy(() -> assertEquals("true", - TimeSeriesRestDriver.getOnlyIndexSettings(client(), originalIndex).get(LifecycleSettings.LIFECYCLE_INDEXING_COMPLETE))); + getOnlyIndexSettings(client(), originalIndex).get(LifecycleSettings.LIFECYCLE_INDEXING_COMPLETE))); } public void testAllocateOnlyAllocation() throws Exception { - createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 2) + createIndexWithSettings(client(), index, alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 2) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)); - String allocateNodeName = "javaRestTest-" + randomFrom(0, 1); + String allocateNodeName = "integTest-" + randomFrom(0, 1); AllocateAction allocateAction = new AllocateAction(null, null, null, singletonMap("_name", allocateNodeName)); String endPhase = randomFrom("warm", "cold"); - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, endPhase, allocateAction); + createNewSingletonPolicy(client(), policy, endPhase, allocateAction); updatePolicy(index, policy); assertBusy(() -> { - assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep(endPhase).getKey())); + assertThat(getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep(endPhase).getKey())); }); ensureGreen(index); } @@ -360,37 +370,37 @@ public void testAllocateActionOnlyReplicas() throws Exception { int numShards = randomFrom(1, 5); int numReplicas = randomFrom(0, 1); int finalNumReplicas = (numReplicas + 1) % 2; - createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, numShards) + createIndexWithSettings(client(), index, alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, numShards) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, numReplicas)); AllocateAction allocateAction = new AllocateAction(finalNumReplicas, null, null, null); String endPhase = randomFrom("warm", "cold"); - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, endPhase, allocateAction); + createNewSingletonPolicy(client(), policy, endPhase, allocateAction); updatePolicy(index, policy); assertBusy(() -> { - Map settings = TimeSeriesRestDriver.getOnlyIndexSettings(client(), index); - assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep(endPhase).getKey())); + Map settings = getOnlyIndexSettings(client(), index); + assertThat(getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep(endPhase).getKey())); assertThat(settings.get(IndexMetadata.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey()), equalTo(String.valueOf(finalNumReplicas))); }); } public void testWaitForSnapshot() throws Exception { - createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) + createIndexWithSettings(client(), index, alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)); String slmPolicy = randomAlphaOfLengthBetween(4, 10); - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "delete", new WaitForSnapshotAction(slmPolicy)); + createNewSingletonPolicy(client(), policy, "delete", new WaitForSnapshotAction(slmPolicy)); updatePolicy(index, policy); assertBusy( () -> { - Map indexILMState = TimeSeriesRestDriver.explainIndex(client(), index); + Map indexILMState = explainIndex(client(), index); assertThat(indexILMState.get("action"), is("wait_for_snapshot")); assertThat(indexILMState.get("failed_step"), is("wait-for-snapshot")); }, slmPolicy); String snapshotRepo = randomAlphaOfLengthBetween(4, 10); - TimeSeriesRestDriver.createSnapshotRepo(client(), snapshotRepo, randomBoolean()); + createSnapshotRepo(client(), snapshotRepo, randomBoolean()); createSlmPolicy(slmPolicy, snapshotRepo); assertBusy( () -> { - Map indexILMState = TimeSeriesRestDriver.explainIndex(client(), index); + Map indexILMState = explainIndex(client(), index); //wait for step to notice that the slm policy is created and to get out of error assertThat(indexILMState.get("failed_step"), nullValue()); assertThat(indexILMState.get("action"), is("wait_for_snapshot")); @@ -400,17 +410,17 @@ public void testWaitForSnapshot() throws Exception { Request request = new Request("PUT", "/_slm/policy/" + slmPolicy + "/_execute"); assertOK(client().performRequest(request)); - assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index).getAction(), equalTo("complete")), slmPolicy); + assertBusy(() -> assertThat(getStepKeyForIndex(client(), index).getAction(), equalTo("complete")), slmPolicy); } public void testWaitForSnapshotSlmExecutedBefore() throws Exception { - createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) + createIndexWithSettings(client(), index, alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)); String slmPolicy = randomAlphaOfLengthBetween(4, 10); - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "delete", new WaitForSnapshotAction(slmPolicy)); + createNewSingletonPolicy(client(), policy, "delete", new WaitForSnapshotAction(slmPolicy)); String snapshotRepo = randomAlphaOfLengthBetween(4, 10); - TimeSeriesRestDriver.createSnapshotRepo(client(), snapshotRepo, randomBoolean()); + createSnapshotRepo(client(), snapshotRepo, randomBoolean()); createSlmPolicy(slmPolicy, snapshotRepo); Request request = new Request("PUT", "/_slm/policy/" + slmPolicy + "/_execute"); @@ -428,7 +438,7 @@ public void testWaitForSnapshotSlmExecutedBefore() throws Exception { updatePolicy(index, policy); assertBusy( () -> { - Map indexILMState = TimeSeriesRestDriver.explainIndex(client(), index); + Map indexILMState = explainIndex(client(), index); assertThat(indexILMState.get("failed_step"), nullValue()); assertThat(indexILMState.get("action"), is("wait_for_snapshot")); assertThat(indexILMState.get("step"), is("wait-for-snapshot")); @@ -446,28 +456,28 @@ public void testWaitForSnapshotSlmExecutedBefore() throws Exception { } }, slmPolicy); - assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index).getAction(), equalTo("complete")), slmPolicy); + assertBusy(() -> assertThat(getStepKeyForIndex(client(), index).getAction(), equalTo("complete")), slmPolicy); } public void testDelete() throws Exception { - createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) + createIndexWithSettings(client(), index, alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)); - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "delete", new DeleteAction()); + createNewSingletonPolicy(client(), policy, "delete", new DeleteAction()); updatePolicy(index, policy); assertBusy(() -> assertFalse(indexExists(index))); } public void testDeleteOnlyShouldNotMakeIndexReadonly() throws Exception { - createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) + createIndexWithSettings(client(), index, alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)); - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "delete", new DeleteAction(), TimeValue.timeValueHours(1)); + createNewSingletonPolicy(client(), policy, "delete", new DeleteAction(), TimeValue.timeValueHours(1)); updatePolicy(index, policy); assertBusy(() -> { - assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index).getAction(), equalTo("complete")); - Map settings = TimeSeriesRestDriver.getOnlyIndexSettings(client(), index); + assertThat(getStepKeyForIndex(client(), index).getAction(), equalTo("complete")); + Map settings = getOnlyIndexSettings(client(), index); assertThat(settings.get(IndexMetadata.INDEX_BLOCKS_WRITE_SETTING.getKey()), not("true")); }); - TimeSeriesRestDriver.indexDocument(client(), index); + indexDocument(client(), index); } public void testDeleteDuringSnapshot() throws Exception { @@ -485,12 +495,12 @@ public void testDeleteDuringSnapshot() throws Exception { .endObject())); assertOK(client().performRequest(request)); // create delete policy - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "delete", new DeleteAction(), TimeValue.timeValueMillis(0)); + createNewSingletonPolicy(client(), policy, "delete", new DeleteAction(), TimeValue.timeValueMillis(0)); // create index without policy - createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) + createIndexWithSettings(client(), index, alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)); // index document so snapshot actually does something - TimeSeriesRestDriver.indexDocument(client(), index); + indexDocument(client(), index); // start snapshot String snapName = "snapshot-" + randomAlphaOfLength(6).toLowerCase(Locale.ROOT); request = new Request("PUT", "/_snapshot/repo/" + snapName); @@ -507,20 +517,19 @@ public void testDeleteDuringSnapshot() throws Exception { } public void testReadOnly() throws Exception { - createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) + createIndexWithSettings(client(), index, alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)); - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "warm", new ReadOnlyAction()); + createNewSingletonPolicy(client(), policy, "warm", new ReadOnlyAction()); updatePolicy(index, policy); assertBusy(() -> { - Map settings = TimeSeriesRestDriver.getOnlyIndexSettings(client(), index); - assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("warm").getKey())); + Map settings = getOnlyIndexSettings(client(), index); + assertThat(getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("warm").getKey())); assertThat(settings.get(IndexMetadata.INDEX_BLOCKS_WRITE_SETTING.getKey()), equalTo("true")); }); } - @SuppressWarnings("unchecked") public void forceMergeActionWithCodec(String codec) throws Exception { - createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) + createIndexWithSettings(client(), index, alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)); for (int i = 0; i < randomIntBetween(2, 10); i++) { Request request = new Request("PUT", index + "/_doc/" + i); @@ -529,29 +538,17 @@ public void forceMergeActionWithCodec(String codec) throws Exception { client().performRequest(request); } - Supplier numSegments = () -> { - try { - Map segmentResponse = getAsMap(index + "/_segments"); - segmentResponse = (Map) segmentResponse.get("indices"); - segmentResponse = (Map) segmentResponse.get(index); - segmentResponse = (Map) segmentResponse.get("shards"); - List> shards = (List>) segmentResponse.get("0"); - return (Integer) shards.get(0).get("num_search_segments"); - } catch (Exception e) { - throw new RuntimeException(e); - } - }; - assertThat(numSegments.get(), greaterThan(1)); - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "warm", new ForceMergeAction(1, codec)); + assertThat(getNumberOfSegments(client(), index), greaterThan(1)); + createNewSingletonPolicy(client(), policy, "warm", new ForceMergeAction(1, codec)); updatePolicy(index, policy); assertBusy(() -> { - assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("warm").getKey())); - Map settings = TimeSeriesRestDriver.getOnlyIndexSettings(client(), index); - assertThat(numSegments.get(), equalTo(1)); + assertThat(getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("warm").getKey())); + Map settings = getOnlyIndexSettings(client(), index); + assertThat(getNumberOfSegments(client(), index), equalTo(1)); assertThat(settings.get(IndexMetadata.INDEX_BLOCKS_WRITE_SETTING.getKey()), equalTo("true")); }); - expectThrows(ResponseException.class, () -> TimeSeriesRestDriver.indexDocument(client(), index)); + expectThrows(ResponseException.class, () -> indexDocument(client(), index)); } public void testForceMergeAction() throws Exception { @@ -563,35 +560,35 @@ public void testShrinkAction() throws Exception { int divisor = randomFrom(2, 4); int expectedFinalShards = numShards / divisor; String shrunkenIndex = ShrinkAction.SHRUNKEN_INDEX_PREFIX + index; - createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, numShards) + createIndexWithSettings(client(), index, alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, numShards) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)); - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "warm", new ShrinkAction(expectedFinalShards)); + createNewSingletonPolicy(client(), policy, "warm", new ShrinkAction(expectedFinalShards)); updatePolicy(index, policy); assertBusy(() -> assertTrue(indexExists(shrunkenIndex)), 30, TimeUnit.SECONDS); assertBusy(() -> assertTrue(aliasExists(shrunkenIndex, index))); - assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), shrunkenIndex), equalTo(PhaseCompleteStep.finalStep("warm").getKey()))); + assertBusy(() -> assertThat(getStepKeyForIndex(client(), shrunkenIndex), equalTo(PhaseCompleteStep.finalStep("warm").getKey()))); assertBusy(() -> { - Map settings = TimeSeriesRestDriver.getOnlyIndexSettings(client(), shrunkenIndex); + Map settings = getOnlyIndexSettings(client(), shrunkenIndex); assertThat(settings.get(IndexMetadata.SETTING_NUMBER_OF_SHARDS), equalTo(String.valueOf(expectedFinalShards))); assertThat(settings.get(IndexMetadata.INDEX_BLOCKS_WRITE_SETTING.getKey()), equalTo("true")); assertThat(settings.get(IndexMetadata.INDEX_ROUTING_REQUIRE_GROUP_SETTING.getKey() + "_id"), nullValue()); }); - expectThrows(ResponseException.class, () -> TimeSeriesRestDriver.indexDocument(client(), index)); + expectThrows(ResponseException.class, () -> indexDocument(client(), index)); } public void testShrinkSameShards() throws Exception { int numberOfShards = randomFrom(1, 2); String shrunkenIndex = ShrinkAction.SHRUNKEN_INDEX_PREFIX + index; - createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, numberOfShards) + createIndexWithSettings(client(), index, alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, numberOfShards) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)); - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "warm", new ShrinkAction(numberOfShards)); + createNewSingletonPolicy(client(), policy, "warm", new ShrinkAction(numberOfShards)); updatePolicy(index, policy); assertBusy(() -> { assertTrue(indexExists(index)); assertFalse(indexExists(shrunkenIndex)); assertFalse(aliasExists(shrunkenIndex, index)); - Map settings = TimeSeriesRestDriver.getOnlyIndexSettings(client(), index); - assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("warm").getKey())); + Map settings = getOnlyIndexSettings(client(), index); + assertThat(getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("warm").getKey())); assertThat(settings.get(IndexMetadata.SETTING_NUMBER_OF_SHARDS), equalTo(String.valueOf(numberOfShards))); assertNull(settings.get(IndexMetadata.INDEX_BLOCKS_WRITE_SETTING.getKey())); assertThat(settings.get(IndexMetadata.INDEX_ROUTING_REQUIRE_GROUP_SETTING.getKey() + "_id"), nullValue()); @@ -614,15 +611,15 @@ public void testShrinkDuringSnapshot() throws Exception { .endObject())); assertOK(client().performRequest(request)); // create delete policy - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "warm", new ShrinkAction(1), TimeValue.timeValueMillis(0)); + createNewSingletonPolicy(client(), policy, "warm", new ShrinkAction(1), TimeValue.timeValueMillis(0)); // create index without policy - createIndexWithSettings(index, Settings.builder() + createIndexWithSettings(client(), index, alias, Settings.builder() .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 2) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) // required so the shrink doesn't wait on SetSingleNodeAllocateStep - .put(IndexMetadata.INDEX_ROUTING_REQUIRE_GROUP_SETTING.getKey() + "_name", "javaRestTest-0")); + .put(IndexMetadata.INDEX_ROUTING_REQUIRE_GROUP_SETTING.getKey() + "_name", "integTest-0")); // index document so snapshot actually does something - TimeSeriesRestDriver.indexDocument(client(), index); + indexDocument(client(), index); // start snapshot request = new Request("PUT", "/_snapshot/repo/snapshot"); request.addParameter("wait_for_completion", "false"); @@ -634,13 +631,13 @@ public void testShrinkDuringSnapshot() throws Exception { assertBusy(() -> { assertTrue(indexExists(shrunkenIndex)); assertTrue(aliasExists(shrunkenIndex, index)); - Map settings = TimeSeriesRestDriver.getOnlyIndexSettings(client(), shrunkenIndex); - assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), shrunkenIndex), equalTo(PhaseCompleteStep.finalStep("warm").getKey())); + Map settings = getOnlyIndexSettings(client(), shrunkenIndex); + assertThat(getStepKeyForIndex(client(), shrunkenIndex), equalTo(PhaseCompleteStep.finalStep("warm").getKey())); assertThat(settings.get(IndexMetadata.SETTING_NUMBER_OF_SHARDS), equalTo(String.valueOf(1))); assertThat(settings.get(IndexMetadata.INDEX_BLOCKS_WRITE_SETTING.getKey()), equalTo("true")); assertThat(settings.get(IndexMetadata.INDEX_ROUTING_REQUIRE_GROUP_SETTING.getKey() + "_id"), nullValue()); }, 2, TimeUnit.MINUTES); - expectThrows(ResponseException.class, () -> TimeSeriesRestDriver.indexDocument(client(), index)); + expectThrows(ResponseException.class, () -> indexDocument(client(), index)); // assert that snapshot succeeded assertThat(getSnapshotState("snapshot"), equalTo("SUCCESS")); assertOK(client().performRequest(new Request("DELETE", "/_snapshot/repo/snapshot"))); @@ -655,9 +652,9 @@ public void testSetSingleNodeAllocationRetriesUntilItSucceeds() throws Exception .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) .putNull(DataTierAllocationDecider.INDEX_ROUTING_INCLUDE)); - ensureGreen(index); + ensureGreen(index); - // unallocate all index shards + // unallocate all index shards Request setAllocationToMissingAttribute = new Request("PUT", "/" + index + "/_settings"); setAllocationToMissingAttribute.setJsonEntity("{\n" + " \"settings\": {\n" + @@ -673,12 +670,12 @@ public void testSetSingleNodeAllocationRetriesUntilItSucceeds() throws Exception }); // assign the policy that'll attempt to shrink the index - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "warm", new ShrinkAction(expectedFinalShards)); + createNewSingletonPolicy(client(), policy, "warm", new ShrinkAction(expectedFinalShards)); updatePolicy(index, policy); assertTrue("ILM did not start retrying the set-single-node-allocation step", waitUntil(() -> { try { - Map explainIndexResponse = TimeSeriesRestDriver.explainIndex(client(), index); + Map explainIndexResponse = explainIndex(client(), index); if (explainIndexResponse == null) { return false; } @@ -700,17 +697,17 @@ public void testSetSingleNodeAllocationRetriesUntilItSucceeds() throws Exception assertBusy(() -> assertTrue(indexExists(shrunkenIndex)), 30, TimeUnit.SECONDS); assertBusy(() -> assertTrue(aliasExists(shrunkenIndex, index))); - assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), shrunkenIndex), equalTo(PhaseCompleteStep.finalStep("warm").getKey()))); + assertBusy(() -> assertThat(getStepKeyForIndex(client(), shrunkenIndex), equalTo(PhaseCompleteStep.finalStep("warm").getKey()))); } public void testFreezeAction() throws Exception { - createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) + createIndexWithSettings(client(), index, alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)); - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "cold", new FreezeAction()); + createNewSingletonPolicy(client(), policy, "cold", new FreezeAction()); updatePolicy(index, policy); assertBusy(() -> { - Map settings = TimeSeriesRestDriver.getOnlyIndexSettings(client(), index); - assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("cold").getKey())); + Map settings = getOnlyIndexSettings(client(), index); + assertThat(getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("cold").getKey())); assertThat(settings.get(IndexMetadata.INDEX_BLOCKS_WRITE_SETTING.getKey()), equalTo("true")); assertThat(settings.get(IndexSettings.INDEX_SEARCH_THROTTLED.getKey()), equalTo("true")); assertThat(settings.get("index.frozen"), equalTo("true")); @@ -732,12 +729,12 @@ public void testFreezeDuringSnapshot() throws Exception { .endObject())); assertOK(client().performRequest(request)); // create delete policy - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "cold", new FreezeAction(), TimeValue.timeValueMillis(0)); + createNewSingletonPolicy(client(), policy, "cold", new FreezeAction(), TimeValue.timeValueMillis(0)); // create index without policy - createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) + createIndexWithSettings(client(), index, alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)); // index document so snapshot actually does something - TimeSeriesRestDriver.indexDocument(client(), index); + indexDocument(client(), index); // start snapshot request = new Request("PUT", "/_snapshot/repo/snapshot"); request.addParameter("wait_for_completion", "false"); @@ -747,8 +744,8 @@ public void testFreezeDuringSnapshot() throws Exception { updatePolicy(index, policy); // assert that the index froze assertBusy(() -> { - Map settings = TimeSeriesRestDriver.getOnlyIndexSettings(client(), index); - assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("cold").getKey())); + Map settings = getOnlyIndexSettings(client(), index); + assertThat(getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("cold").getKey())); assertThat(settings.get(IndexMetadata.INDEX_BLOCKS_WRITE_SETTING.getKey()), equalTo("true")); assertThat(settings.get(IndexSettings.INDEX_SEARCH_THROTTLED.getKey()), equalTo("true")); assertThat(settings.get("index.frozen"), equalTo("true")); @@ -759,26 +756,26 @@ public void testFreezeDuringSnapshot() throws Exception { } public void testSetPriority() throws Exception { - createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) + createIndexWithSettings(client(), index, alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0).put(IndexMetadata.INDEX_PRIORITY_SETTING.getKey(), 100)); int priority = randomIntBetween(0, 99); - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "warm", new SetPriorityAction(priority)); + createNewSingletonPolicy(client(), policy, "warm", new SetPriorityAction(priority)); updatePolicy(index, policy); assertBusy(() -> { - Map settings = TimeSeriesRestDriver.getOnlyIndexSettings(client(), index); - assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("warm").getKey())); + Map settings = getOnlyIndexSettings(client(), index); + assertThat(getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("warm").getKey())); assertThat(settings.get(IndexMetadata.INDEX_PRIORITY_SETTING.getKey()), equalTo(String.valueOf(priority))); }); } public void testSetNullPriority() throws Exception { - createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) + createIndexWithSettings(client(), index, alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0).put(IndexMetadata.INDEX_PRIORITY_SETTING.getKey(), 100)); - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "warm", new SetPriorityAction((Integer) null)); + createNewSingletonPolicy(client(), policy, "warm", new SetPriorityAction((Integer) null)); updatePolicy(index, policy); assertBusy(() -> { - Map settings = TimeSeriesRestDriver.getOnlyIndexSettings(client(), index); - assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("warm").getKey())); + Map settings = getOnlyIndexSettings(client(), index); + assertThat(getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("warm").getKey())); assertNull(settings.get(IndexMetadata.INDEX_PRIORITY_SETTING.getKey())); }); } @@ -802,7 +799,7 @@ public void testNonexistentPolicy() throws Exception { client().performRequest(templateRequest); policy = randomAlphaOfLengthBetween(5,20); - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); + createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); index = indexPrefix + "-000001"; final StringEntity putIndex = new StringEntity("{\n" + @@ -815,7 +812,7 @@ public void testNonexistentPolicy() throws Exception { Request putIndexRequest = new Request("PUT", index); putIndexRequest.setEntity(putIndex); client().performRequest(putIndexRequest); - TimeSeriesRestDriver.indexDocument(client(), index); + indexDocument(client(), index); assertBusy(() -> { Request explainRequest = new Request("GET", index + "/_ilm/explain"); @@ -840,19 +837,19 @@ public void testInvalidPolicyNames() { ResponseException ex; policy = randomAlphaOfLengthBetween(0,10) + "," + randomAlphaOfLengthBetween(0,10); - ex = expectThrows(ResponseException.class, () -> TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "delete", new DeleteAction())); + ex = expectThrows(ResponseException.class, () -> createNewSingletonPolicy(client(), policy, "delete", new DeleteAction())); assertThat(ex.getMessage(), containsString("invalid policy name")); policy = randomAlphaOfLengthBetween(0,10) + "%20" + randomAlphaOfLengthBetween(0,10); - ex = expectThrows(ResponseException.class, () -> TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "delete", new DeleteAction())); + ex = expectThrows(ResponseException.class, () -> createNewSingletonPolicy(client(), policy, "delete", new DeleteAction())); assertThat(ex.getMessage(), containsString("invalid policy name")); policy = "_" + randomAlphaOfLengthBetween(1, 20); - ex = expectThrows(ResponseException.class, () -> TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "delete", new DeleteAction())); + ex = expectThrows(ResponseException.class, () -> createNewSingletonPolicy(client(), policy, "delete", new DeleteAction())); assertThat(ex.getMessage(), containsString("invalid policy name")); policy = randomAlphaOfLengthBetween(256, 1000); - ex = expectThrows(ResponseException.class, () -> TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "delete", new DeleteAction())); + ex = expectThrows(ResponseException.class, () -> createNewSingletonPolicy(client(), policy, "delete", new DeleteAction())); assertThat(ex.getMessage(), containsString("invalid policy name")); } @@ -862,11 +859,11 @@ public void testDeletePolicyInUse() throws IOException { String unmanagedIndex = randomAlphaOfLength(9).toLowerCase(Locale.ROOT); String managedByOtherPolicyIndex = randomAlphaOfLength(10).toLowerCase(Locale.ROOT); - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "delete", new DeleteAction(), TimeValue.timeValueHours(12)); + createNewSingletonPolicy(client(), policy, "delete", new DeleteAction(), TimeValue.timeValueHours(12)); String originalPolicy = policy; String otherPolicy = randomValueOtherThan(policy, () -> randomAlphaOfLength(5)); policy = otherPolicy; - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "delete", new DeleteAction(), TimeValue.timeValueHours(13)); + createNewSingletonPolicy(client(), policy, "delete", new DeleteAction(), TimeValue.timeValueHours(13)); createIndexWithSettingsNoAlias(managedIndex1, Settings.builder() .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, randomIntBetween(1,10)) @@ -895,9 +892,11 @@ public void testRemoveAndReaddPolicy() throws Exception { String originalIndex = index + "-000001"; String secondIndex = index + "-000002"; // Set up a policy with rollover - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); + createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); createIndexWithSettings( + client(), originalIndex, + alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) .put(LifecycleSettings.LIFECYCLE_NAME, policy) @@ -923,22 +922,22 @@ public void testRemoveAndReaddPolicy() throws Exception { " }\n" + "}"); client().performRequest(addPolicyRequest); - assertBusy(() -> assertTrue((boolean) TimeSeriesRestDriver.explainIndex(client(), originalIndex).getOrDefault("managed", false))); + assertBusy(() -> assertTrue((boolean) explainIndex(client(), originalIndex).getOrDefault("managed", false))); // Wait for everything to be copacetic - assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), originalIndex), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); + assertBusy(() -> assertThat(getStepKeyForIndex(client(), originalIndex), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); } public void testMoveToInjectedStep() throws Exception { String shrunkenIndex = ShrinkAction.SHRUNKEN_INDEX_PREFIX + index; - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "warm", new ShrinkAction(1), TimeValue.timeValueHours(12)); + createNewSingletonPolicy(client(), policy, "warm", new ShrinkAction(1), TimeValue.timeValueHours(12)); - createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 3) + createIndexWithSettings(client(), index, alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 3) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) .put(LifecycleSettings.LIFECYCLE_NAME, policy) .put(RolloverAction.LIFECYCLE_ROLLOVER_ALIAS, alias)); - assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index), equalTo(new StepKey("new", "complete", "complete")))); + assertBusy(() -> assertThat(getStepKeyForIndex(client(), index), equalTo(new StepKey("new", "complete", "complete")))); // Move to a step from the injected unfollow action Request moveToStepRequest = new Request("POST", "_ilm/move/" + index); @@ -961,25 +960,25 @@ public void testMoveToInjectedStep() throws Exception { assertBusy(() -> { assertTrue(indexExists(shrunkenIndex)); assertTrue(aliasExists(shrunkenIndex, index)); - assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), shrunkenIndex), equalTo(PhaseCompleteStep.finalStep("warm").getKey())); + assertThat(getStepKeyForIndex(client(), shrunkenIndex), equalTo(PhaseCompleteStep.finalStep("warm").getKey())); }, 30, TimeUnit.SECONDS); } @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/53612") public void testMoveToStepRereadsPolicy() throws Exception { - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, TimeValue.timeValueHours(1), null), TimeValue.ZERO); + createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, TimeValue.timeValueHours(1), null), TimeValue.ZERO); - createIndexWithSettings("test-1", Settings.builder() + createIndexWithSettings(client(), "test-1", alias, Settings.builder() .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) .put(LifecycleSettings.LIFECYCLE_NAME, policy) .put(RolloverAction.LIFECYCLE_ROLLOVER_ALIAS, alias), true); - assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), "test-1"), + assertBusy(() -> assertThat(getStepKeyForIndex(client(), "test-1"), equalTo(new StepKey("hot", "rollover", "check-rollover-ready")))); - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, TimeValue.timeValueSeconds(1), null), TimeValue.ZERO); + createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, TimeValue.timeValueSeconds(1), null), TimeValue.ZERO); // Move to the same step, which should re-read the policy Request moveToStepRequest = new Request("POST", "_ilm/move/test-1"); @@ -1004,7 +1003,7 @@ public void testMoveToStepRereadsPolicy() throws Exception { } public void testCanStopILMWithPolicyUsingNonexistentPolicy() throws Exception { - createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) + createIndexWithSettings(client(), index, alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) .put(LifecycleSettings.LIFECYCLE_NAME_SETTING.getKey(), randomAlphaOfLengthBetween(5,15))); @@ -1031,7 +1030,7 @@ public void testExplainFilters() throws Exception { String nonexistantPolicyIndex = index + "-nonexistant-policy"; String unmanagedIndex = index + "-unmanaged"; - TimeSeriesRestDriver.createFullPolicy(client(), policy, TimeValue.ZERO); + createFullPolicy(client(), policy, TimeValue.ZERO); { // Create a "shrink-only-policy" @@ -1050,7 +1049,7 @@ public void testExplainFilters() throws Exception { assertOK(client().performRequest(request)); } - createIndexWithSettings(goodIndex, Settings.builder() + createIndexWithSettings(client(), goodIndex, alias, Settings.builder() .put(RolloverAction.LIFECYCLE_ROLLOVER_ALIAS, alias) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) .put(LifecycleSettings.LIFECYCLE_NAME, policy) @@ -1066,17 +1065,17 @@ public void testExplainFilters() throws Exception { .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)); assertBusy(() -> { - Map> explainResponse = TimeSeriesRestDriver.explain(client(), index + "*", false, false); + Map> explainResponse = explain(client(), index + "*", false, false); assertNotNull(explainResponse); assertThat(explainResponse, allOf(hasKey(goodIndex), hasKey(errorIndex), hasKey(nonexistantPolicyIndex), hasKey(unmanagedIndex))); - Map> onlyManagedResponse = TimeSeriesRestDriver.explain(client(), index + "*", false, true); + Map> onlyManagedResponse = explain(client(), index + "*", false, true); assertNotNull(onlyManagedResponse); assertThat(onlyManagedResponse, allOf(hasKey(goodIndex), hasKey(errorIndex), hasKey(nonexistantPolicyIndex))); assertThat(onlyManagedResponse, not(hasKey(unmanagedIndex))); - Map> onlyErrorsResponse = TimeSeriesRestDriver.explain(client(), index + "*", true, true); + Map> onlyErrorsResponse = explain(client(), index + "*", true, true); assertNotNull(onlyErrorsResponse); assertThat(onlyErrorsResponse, allOf(hasKey(errorIndex), hasKey(nonexistantPolicyIndex))); assertThat(onlyErrorsResponse, allOf(not(hasKey(goodIndex)), not(hasKey(unmanagedIndex)))); @@ -1084,7 +1083,7 @@ public void testExplainFilters() throws Exception { } public void testExplainIndexContainsAutomaticRetriesInformation() throws Exception { - TimeSeriesRestDriver.createFullPolicy(client(), policy, TimeValue.ZERO); + createFullPolicy(client(), policy, TimeValue.ZERO); // create index without alias so the rollover action fails and is retried createIndexWithSettingsNoAlias(index, Settings.builder() @@ -1093,7 +1092,7 @@ public void testExplainIndexContainsAutomaticRetriesInformation() throws Excepti ); assertBusy(() -> { - Map explainIndex = TimeSeriesRestDriver.explainIndex(client(), index); + Map explainIndex = explainIndex(client(), index); assertThat((Integer) explainIndex.get(FAILED_STEP_RETRY_COUNT_FIELD), greaterThanOrEqualTo(1)); assertThat(explainIndex.get(IS_AUTO_RETRYABLE_ERROR_FIELD), is(true)); }); @@ -1102,11 +1101,13 @@ public void testExplainIndexContainsAutomaticRetriesInformation() throws Excepti public void testILMRolloverRetriesOnReadOnlyBlock() throws Exception { String firstIndex = index + "-000001"; - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, TimeValue.timeValueSeconds(1), null)); + createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, TimeValue.timeValueSeconds(1), null)); // create the index as readonly and associate the ILM policy to it createIndexWithSettings( + client(), firstIndex, + alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) .put(LifecycleSettings.LIFECYCLE_NAME, policy) @@ -1116,7 +1117,7 @@ public void testILMRolloverRetriesOnReadOnlyBlock() throws Exception { ); // wait for ILM to start retrying the step - assertBusy(() -> assertThat((Integer) TimeSeriesRestDriver.explainIndex(client(), firstIndex).get(FAILED_STEP_RETRY_COUNT_FIELD), + assertBusy(() -> assertThat((Integer) explainIndex(client(), firstIndex).get(FAILED_STEP_RETRY_COUNT_FIELD), greaterThanOrEqualTo(1))); // remove the read only block @@ -1129,7 +1130,7 @@ public void testILMRolloverRetriesOnReadOnlyBlock() throws Exception { client().performRequest(allowWritesOnIndexSettingUpdate); // index is not readonly so the ILM should complete successfully - assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), firstIndex), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); + assertBusy(() -> assertThat(getStepKeyForIndex(client(), firstIndex), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); } public void testILMRolloverOnManuallyRolledIndex() throws Exception { @@ -1138,7 +1139,7 @@ public void testILMRolloverOnManuallyRolledIndex() throws Exception { String thirdIndex = index + "-000003"; // Set up a policy with rollover - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 2L)); + createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 2L)); Request createIndexTemplate = new Request("PUT", "_template/rolling_indexes"); createIndexTemplate.setJsonEntity("{" + "\"index_patterns\": [\"" + index + "-*\"], \n" + @@ -1152,7 +1153,9 @@ public void testILMRolloverOnManuallyRolledIndex() throws Exception { client().performRequest(createIndexTemplate); createIndexWithSettings( + client(), originalIndex, + alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0), true @@ -1164,7 +1167,7 @@ public void testILMRolloverOnManuallyRolledIndex() throws Exception { client().performRequest(refreshOriginalIndex); // Manual rollover - TimeSeriesRestDriver.rolloverMaxOneDocCondition(client(), alias); + rolloverMaxOneDocCondition(client(), alias); assertBusy(() -> assertTrue(indexExists(secondIndex))); // Index another document into the original index so the ILM rollover policy condition is met @@ -1172,10 +1175,10 @@ public void testILMRolloverOnManuallyRolledIndex() throws Exception { client().performRequest(refreshOriginalIndex); // Wait for the rollover policy to execute - assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), originalIndex), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); + assertBusy(() -> assertThat(getStepKeyForIndex(client(), originalIndex), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); // ILM should manage the second index after attempting (and skipping) rolling the original index - assertBusy(() -> assertTrue((boolean) TimeSeriesRestDriver.explainIndex(client(), secondIndex).getOrDefault("managed", true))); + assertBusy(() -> assertTrue((boolean) explainIndex(client(), secondIndex).getOrDefault("managed", true))); // index some documents to trigger an ILM rollover index(client(), alias, "1", "foo", "bar"); @@ -1185,7 +1188,7 @@ public void testILMRolloverOnManuallyRolledIndex() throws Exception { client().performRequest(refreshSecondIndex).getStatusLine(); // ILM should rollover the second index even though it skipped the first one - assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), secondIndex), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); + assertBusy(() -> assertThat(getStepKeyForIndex(client(), secondIndex), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); assertBusy(() -> assertTrue(indexExists(thirdIndex))); } @@ -1193,11 +1196,13 @@ public void testRolloverStepRetriesUntilRolledOverIndexIsDeleted() throws Except String index = this.index + "-000001"; String rolledIndex = this.index + "-000002"; - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, TimeValue.timeValueSeconds(1), null)); + createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, TimeValue.timeValueSeconds(1), null)); // create the rolled index so the rollover of the first index fails createIndexWithSettings( + client(), rolledIndex, + alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) .put(RolloverAction.LIFECYCLE_ROLLOVER_ALIAS, alias), @@ -1205,7 +1210,9 @@ public void testRolloverStepRetriesUntilRolledOverIndexIsDeleted() throws Except ); createIndexWithSettings( + client(), index, + alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) .put(LifecycleSettings.LIFECYCLE_NAME, policy) @@ -1213,7 +1220,7 @@ public void testRolloverStepRetriesUntilRolledOverIndexIsDeleted() throws Except true ); - assertBusy(() -> assertThat((Integer) TimeSeriesRestDriver.explainIndex(client(), index).get(FAILED_STEP_RETRY_COUNT_FIELD), greaterThanOrEqualTo(1)), + assertBusy(() -> assertThat((Integer) explainIndex(client(), index).get(FAILED_STEP_RETRY_COUNT_FIELD), greaterThanOrEqualTo(1)), 30, TimeUnit.SECONDS); @@ -1247,7 +1254,7 @@ public void testRolloverStepRetriesUntilRolledOverIndexIsDeleted() throws Except // retried (which means ILM moves back and forth between the `attempt-rollover` step and the `error` step) assertTrue("ILM did not start retrying the attempt-rollover step", waitUntil(() -> { try { - Map explainIndexResponse = TimeSeriesRestDriver.explainIndex(client(), index); + Map explainIndexResponse = explainIndex(client(), index); String failedStep = (String) explainIndexResponse.get("failed_step"); Integer retryCount = (Integer) explainIndexResponse.get(FAILED_STEP_RETRY_COUNT_FIELD); return failedStep != null && failedStep.equals("attempt-rollover") && retryCount != null && retryCount >= 1; @@ -1260,16 +1267,18 @@ public void testRolloverStepRetriesUntilRolledOverIndexIsDeleted() throws Except // the rollover step should eventually succeed assertBusy(() -> assertThat(indexExists(rolledIndex), is(true))); - assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); + assertBusy(() -> assertThat(getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); } public void testUpdateRolloverLifecycleDateStepRetriesWhenRolloverInfoIsMissing() throws Exception { String index = this.index + "-000001"; - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); + createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); createIndexWithSettings( + client(), index, + alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) .put(LifecycleSettings.LIFECYCLE_NAME, policy) @@ -1277,7 +1286,7 @@ public void testUpdateRolloverLifecycleDateStepRetriesWhenRolloverInfoIsMissing( true ); - assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index).getName(), Matchers.is(WaitForRolloverReadyStep.NAME))); + assertBusy(() -> assertThat(getStepKeyForIndex(client(), index).getName(), is(WaitForRolloverReadyStep.NAME))); // moving ILM to the "update-rollover-lifecycle-date" without having gone through the actual rollover step // the "update-rollover-lifecycle-date" step will fail as the index has no rollover information @@ -1298,7 +1307,7 @@ public void testUpdateRolloverLifecycleDateStepRetriesWhenRolloverInfoIsMissing( assertTrue("ILM did not start retrying the update-rollover-lifecycle-date step", waitUntil(() -> { try { - Map explainIndexResponse = TimeSeriesRestDriver.explainIndex(client(), index); + Map explainIndexResponse = explainIndex(client(), index); String failedStep = (String) explainIndexResponse.get("failed_step"); Integer retryCount = (Integer) explainIndexResponse.get(FAILED_STEP_RETRY_COUNT_FIELD); return failedStep != null && failedStep.equals(UpdateRolloverLifecycleDateStep.NAME) && retryCount != null @@ -1314,20 +1323,20 @@ public void testUpdateRolloverLifecycleDateStepRetriesWhenRolloverInfoIsMissing( // manual rollover the index so the "update-rollover-lifecycle-date" ILM step can continue and finish successfully as the index // will have rollover information now - TimeSeriesRestDriver.rolloverMaxOneDocCondition(client(), alias); - assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); + rolloverMaxOneDocCondition(client(), alias); + assertBusy(() -> assertThat(getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); } public void testWaitForActiveShardsStep() throws Exception { String originalIndex = index + "-000001"; String secondIndex = index + "-000002"; - createIndexWithSettings(originalIndex, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) - .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) - .put(RolloverAction.LIFECYCLE_ROLLOVER_ALIAS, alias), + createIndexWithSettings(client(), originalIndex, alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) + .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) + .put(RolloverAction.LIFECYCLE_ROLLOVER_ALIAS, alias), true); // create policy - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); + createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); // update policy on index updatePolicy(originalIndex, policy); Request createIndexTemplate = new Request("PUT", "_template/rolling_indexes"); @@ -1345,17 +1354,17 @@ public void testWaitForActiveShardsStep() throws Exception { index(client(), originalIndex, "_id", "foo", "bar"); assertBusy(() -> assertTrue(indexExists(secondIndex))); - assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), originalIndex).getName(), equalTo(WaitForActiveShardsStep.NAME))); + assertBusy(() -> assertThat(getStepKeyForIndex(client(), originalIndex).getName(), equalTo(WaitForActiveShardsStep.NAME))); // reset the number of replicas to 0 so that the second index wait for active shard condition can be met updateIndexSettings(secondIndex, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)); - assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), originalIndex), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); + assertBusy(() -> assertThat(getStepKeyForIndex(client(), originalIndex), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); } @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/54093") public void testHistoryIsWrittenWithSuccess() throws Exception { - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); + createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); Request createIndexTemplate = new Request("PUT", "_template/rolling_indexes"); createIndexTemplate.setJsonEntity("{" + "\"index_patterns\": [\""+ index + "-*\"], \n" + @@ -1368,14 +1377,14 @@ public void testHistoryIsWrittenWithSuccess() throws Exception { "}"); client().performRequest(createIndexTemplate); - createIndexWithSettings(index + "-1", Settings.builder(), true); + createIndexWithSettings(client(), index + "-1", alias, Settings.builder(), true); // Index a document index(client(), index + "-1", "1", "foo", "bar"); Request refreshIndex = new Request("POST", "/" + index + "-1/_refresh"); client().performRequest(refreshIndex); - assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index + "-1"), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); + assertBusy(() -> assertThat(getStepKeyForIndex(client(), index + "-1"), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); assertBusy(() -> assertHistoryIsPresent(policy, index + "-1", true, "wait-for-indexing-complete"), 30, TimeUnit.SECONDS); assertBusy(() -> assertHistoryIsPresent(policy, index + "-1", true, "wait-for-follow-shard-tasks"), 30, TimeUnit.SECONDS); @@ -1394,8 +1403,8 @@ public void testHistoryIsWrittenWithSuccess() throws Exception { @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/50353") public void testHistoryIsWrittenWithFailure() throws Exception { - createIndexWithSettings(index + "-1", Settings.builder(), false); - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); + createIndexWithSettings(client(), index + "-1", alias, Settings.builder(), false); + createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); updatePolicy(index + "-1", policy); // Index a document @@ -1404,7 +1413,7 @@ public void testHistoryIsWrittenWithFailure() throws Exception { client().performRequest(refreshIndex); // Check that we've had error and auto retried - assertBusy(() -> assertThat((Integer) TimeSeriesRestDriver.explainIndex(client(), index + "-1").get("failed_step_retry_count"), + assertBusy(() -> assertThat((Integer) explainIndex(client(), index + "-1").get("failed_step_retry_count"), greaterThanOrEqualTo(1))); assertBusy(() -> assertHistoryIsPresent(policy, index + "-1", false, "ERROR"), 30, TimeUnit.SECONDS); @@ -1413,8 +1422,8 @@ public void testHistoryIsWrittenWithFailure() throws Exception { @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/53718") public void testHistoryIsWrittenWithDeletion() throws Exception { // Index should be created and then deleted by ILM - createIndexWithSettings(index, Settings.builder(), false); - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "delete", new DeleteAction()); + createIndexWithSettings(client(), index, alias, Settings.builder(), false); + createNewSingletonPolicy(client(), policy, "delete", new DeleteAction()); updatePolicy(index, policy); assertBusy(() -> assertFalse(indexExists(index))); @@ -1430,14 +1439,16 @@ public void testRetryableInitializationStep() throws Exception { Request stopReq = new Request("POST", "/_ilm/stop"); Request startReq = new Request("POST", "/_ilm/start"); - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new SetPriorityAction(1)); + createNewSingletonPolicy(client(), policy, "hot", new SetPriorityAction(1)); // Stop ILM so that the initialize step doesn't run assertOK(client().performRequest(stopReq)); // Create the index with the origination parsing turn *off* so it doesn't prevent creation createIndexWithSettings( + client(), index, + alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) .put(LifecycleSettings.LIFECYCLE_NAME, policy) @@ -1451,7 +1462,7 @@ public void testRetryableInitializationStep() throws Exception { // Wait until an error has occurred. assertTrue("ILM did not start retrying the init step", waitUntil(() -> { try { - Map explainIndexResponse = TimeSeriesRestDriver.explainIndex(client(), index); + Map explainIndexResponse = explainIndex(client(), index); String failedStep = (String) explainIndexResponse.get("failed_step"); Integer retryCount = (Integer) explainIndexResponse.get(FAILED_STEP_RETRY_COUNT_FIELD); return failedStep != null && failedStep.equals(InitializePolicyContextStep.KEY.getAction()) && retryCount != null @@ -1466,7 +1477,7 @@ public void testRetryableInitializationStep() throws Exception { .put(LifecycleSettings.LIFECYCLE_PARSE_ORIGINATION_DATE, false)); assertBusy(() -> { - Map explainResp = TimeSeriesRestDriver.explainIndex(client(), index); + Map explainResp = explainIndex(client(), index); String phase = (String) explainResp.get("phase"); assertThat(phase, equalTo("hot")); }); @@ -1475,7 +1486,7 @@ public void testRetryableInitializationStep() throws Exception { public void testRefreshablePhaseJson() throws Exception { String index = "refresh-index"; - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 100L)); + createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 100L)); Request createIndexTemplate = new Request("PUT", "_template/rolling_indexes"); createIndexTemplate.setJsonEntity("{" + "\"index_patterns\": [\""+ index + "-*\"], \n" + @@ -1488,7 +1499,7 @@ public void testRefreshablePhaseJson() throws Exception { "}"); client().performRequest(createIndexTemplate); - createIndexWithSettings(index + "-1", + createIndexWithSettings(client(), index + "-1", alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0), true); @@ -1497,22 +1508,22 @@ public void testRefreshablePhaseJson() throws Exception { index(client(), index + "-1", "1", "foo", "bar"); // Wait for the index to enter the check-rollover-ready step - assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index + "-1").getName(), equalTo(WaitForRolloverReadyStep.NAME))); + assertBusy(() -> assertThat(getStepKeyForIndex(client(), index + "-1").getName(), equalTo(WaitForRolloverReadyStep.NAME))); // Update the policy to allow rollover at 1 document instead of 100 - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); + createNewSingletonPolicy(client(), policy, "hot", new RolloverAction(null, null, 1L)); // Index should now have been able to roll over, creating the new index and proceeding to the "complete" step assertBusy(() -> assertThat(indexExists(index + "-000002"), is(true))); - assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index + "-1").getName(), equalTo(PhaseCompleteStep.NAME))); + assertBusy(() -> assertThat(getStepKeyForIndex(client(), index + "-1").getName(), equalTo(PhaseCompleteStep.NAME))); } public void testHaltAtEndOfPhase() throws Exception { String index = "halt-index"; - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "hot", new SetPriorityAction(100)); + createNewSingletonPolicy(client(), policy, "hot", new SetPriorityAction(100)); - createIndexWithSettings(index, + createIndexWithSettings(client(), index, alias, Settings.builder() .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) @@ -1520,7 +1531,7 @@ public void testHaltAtEndOfPhase() throws Exception { randomBoolean()); // Wait for the index to finish the "hot" phase - assertBusy(() -> assertThat(TimeSeriesRestDriver.getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); + assertBusy(() -> assertThat(getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("hot").getKey()))); // Update the policy to add a delete phase { @@ -1544,92 +1555,10 @@ public void testHaltAtEndOfPhase() throws Exception { assertBusy(() -> assertFalse("expected " + index + " to be deleted by ILM", indexExists(index))); } - public void testSearchableSnapshotAction() throws Exception { - String snapshotRepo = randomAlphaOfLengthBetween(4, 10); - TimeSeriesRestDriver.createSnapshotRepo(client(), snapshotRepo, randomBoolean()); - TimeSeriesRestDriver.createNewSingletonPolicy(client(), policy, "cold", new SearchableSnapshotAction(snapshotRepo)); - - createIndexWithSettings(index, - Settings.builder() - .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) - .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) - .put(LifecycleSettings.LIFECYCLE_NAME, policy), - randomBoolean()); - - String restoredIndexName = SearchableSnapshotAction.RESTORED_INDEX_PREFIX + this.index; - assertTrue(waitUntil(() -> { - try { - return indexExists(restoredIndexName); - } catch (IOException e) { - return false; - } - }, 30, TimeUnit.SECONDS)); - - assertBusy(() -> assertThat(TimeSeriesRestDriver.explainIndex(client(), restoredIndexName).get("step"), Matchers.is(PhaseCompleteStep.NAME)), 30, - TimeUnit.SECONDS); - } - - @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/pull/54433") - public void testDeleteActionDeletesSearchableSnapshot() throws Exception { - String snapshotRepo = randomAlphaOfLengthBetween(4, 10); - TimeSeriesRestDriver.createSnapshotRepo(client(), snapshotRepo, randomBoolean()); - - // create policy with cold and delete phases - Map coldActions = - Map.of(SearchableSnapshotAction.NAME, new SearchableSnapshotAction(snapshotRepo)); - Map phases = new HashMap<>(); - phases.put("cold", new Phase("cold", TimeValue.ZERO, coldActions)); - phases.put("delete", new Phase("delete", TimeValue.timeValueMillis(10000), singletonMap(DeleteAction.NAME, - new DeleteAction(true)))); - LifecyclePolicy lifecyclePolicy = new LifecyclePolicy(policy, phases); - // PUT policy - XContentBuilder builder = jsonBuilder(); - lifecyclePolicy.toXContent(builder, null); - final StringEntity entity = new StringEntity( - "{ \"policy\":" + Strings.toString(builder) + "}", ContentType.APPLICATION_JSON); - Request createPolicyRequest = new Request("PUT", "_ilm/policy/" + policy); - createPolicyRequest.setEntity(entity); - assertOK(client().performRequest(createPolicyRequest)); - - createIndexWithSettings(index, - Settings.builder() - .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) - .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) - .put(LifecycleSettings.LIFECYCLE_NAME, policy), - randomBoolean()); - - String[] snapshotName = new String[1]; - String restoredIndexName = SearchableSnapshotAction.RESTORED_INDEX_PREFIX + this.index; - assertTrue(waitUntil(() -> { - try { - Map explainIndex = TimeSeriesRestDriver.explainIndex(client(), index); - if(explainIndex == null) { - // in case we missed the original index and it was deleted - explainIndex = TimeSeriesRestDriver.explainIndex(client(), restoredIndexName); - } - snapshotName[0] = (String) explainIndex.get("snapshot_name"); - return snapshotName[0] != null; - } catch (IOException e) { - return false; - } - }, 30, TimeUnit.SECONDS)); - assertBusy(() -> assertFalse(indexExists(restoredIndexName))); - - assertTrue("the snapshot we generate in the cold phase should be deleted by the delete phase", waitUntil(() -> { - try { - Request getSnapshotsRequest = new Request("GET", "_snapshot/" + snapshotRepo + "/" + snapshotName[0]); - Response getSnapshotsResponse = client().performRequest(getSnapshotsRequest); - return EntityUtils.toString(getSnapshotsResponse.getEntity()).contains("snapshot_missing_exception"); - } catch (IOException e) { - return false; - } - }, 30, TimeUnit.SECONDS)); - } - @SuppressWarnings("unchecked") public void testDeleteActionDoesntDeleteSearchableSnapshot() throws Exception { String snapshotRepo = randomAlphaOfLengthBetween(4, 10); - TimeSeriesRestDriver.createSnapshotRepo(client(), snapshotRepo, randomBoolean()); + createSnapshotRepo(client(), snapshotRepo, randomBoolean()); // create policy with cold and delete phases Map coldActions = @@ -1648,7 +1577,7 @@ public void testDeleteActionDoesntDeleteSearchableSnapshot() throws Exception { createPolicyRequest.setEntity(entity); assertOK(client().performRequest(createPolicyRequest)); - createIndexWithSettings(index, + createIndexWithSettings(client(), index, alias, Settings.builder() .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) @@ -1659,10 +1588,10 @@ public void testDeleteActionDoesntDeleteSearchableSnapshot() throws Exception { String restoredIndexName = SearchableSnapshotAction.RESTORED_INDEX_PREFIX + this.index; assertTrue(waitUntil(() -> { try { - Map explainIndex = TimeSeriesRestDriver.explainIndex(client(), index); + Map explainIndex = explainIndex(client(), index); if(explainIndex == null) { // in case we missed the original index and it was deleted - explainIndex = TimeSeriesRestDriver.explainIndex(client(), restoredIndexName); + explainIndex = explainIndex(client(), restoredIndexName); } snapshotName[0] = (String) explainIndex.get("snapshot_name"); return snapshotName[0] != null; @@ -1790,7 +1719,7 @@ private void assertHistoryIsPresent(String policyName, String indexName, boolean } // Finally, check that the history index is in a good state - Step.StepKey stepKey = TimeSeriesRestDriver.getStepKeyForIndex(client(), "ilm-history-2-000001"); + Step.StepKey stepKey = getStepKeyForIndex(client(), "ilm-history-2-000001"); assertEquals("hot", stepKey.getPhase()); assertEquals(RolloverAction.NAME, stepKey.getAction()); assertEquals(WaitForRolloverReadyStep.NAME, stepKey.getName()); @@ -1805,24 +1734,6 @@ private void createIndexWithSettingsNoAlias(String index, Settings.Builder setti ensureGreen(index); } - private void createIndexWithSettings(String index, Settings.Builder settings) throws IOException { - createIndexWithSettings(index, settings, randomBoolean()); - } - - private void createIndexWithSettings(String index, Settings.Builder settings, boolean useWriteIndex) throws IOException { - Request request = new Request("PUT", "/" + index); - - String writeIndexSnippet = ""; - if (useWriteIndex) { - writeIndexSnippet = "\"is_write_index\": true"; - } - request.setJsonEntity("{\n \"settings\": " + Strings.toString(settings.build()) - + ", \"aliases\" : { \"" + alias + "\": { " + writeIndexSnippet + " } } }"); - client().performRequest(request); - // wait for the shards to initialize - ensureGreen(index); - } - private static void index(RestClient client, String index, String id, Object... fields) throws IOException { XContentBuilder document = jsonBuilder().startObject(); for (int i = 0; i < fields.length; i += 2) { @@ -1836,7 +1747,7 @@ private static void index(RestClient client, String index, String id, Object... @Nullable private String getFailedStepForIndex(String indexName) throws IOException { - Map indexResponse = TimeSeriesRestDriver.explainIndex(client(), indexName); + Map indexResponse = explainIndex(client(), indexName); if (indexResponse == null) { return null; } @@ -1868,7 +1779,7 @@ private void createSlmPolicy(String smlPolicy, String repo) throws IOException { .field("repository", repo) .field("name", "snap" + randomAlphaOfLengthBetween(5, 10).toLowerCase(Locale.ROOT)) .startObject("config") - .field("include_global_state", false) + .field("include_global_state", false) .endObject() .endObject())); @@ -1887,7 +1798,7 @@ private void assertBusy(CheckedRunnable runnable, String slmPolicy) t } catch (Exception ignored) { slm = new HashMap<>(); } - throw new AssertionError("Index:" + TimeSeriesRestDriver.explainIndex(client(), index) + "\nSLM:" + slm, e); + throw new AssertionError("Index:" + explainIndex(client(), index) + "\nSLM:" + slm, e); } }); } From 9f15419764e6079b62c15ff95d0ea19d228f1caf Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Tue, 1 Sep 2020 12:31:46 -0500 Subject: [PATCH 24/25] fix available processors --- x-pack/plugin/identity-provider/build.gradle | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/x-pack/plugin/identity-provider/build.gradle b/x-pack/plugin/identity-provider/build.gradle index b2b772ede7453..fdda23372b28f 100644 --- a/x-pack/plugin/identity-provider/build.gradle +++ b/x-pack/plugin/identity-provider/build.gradle @@ -353,6 +353,11 @@ test { systemProperty 'es.set.netty.runtime.available.processors', 'false' } +internalClusterTest { + systemProperty 'es.set.netty.runtime.available.processors', 'false' +} + + // xpack modules are installed in real clusters as the meta plugin, so // installing them as individual plugins for integ tests doesn't make sense, // so we disable integ tests From 666ae84d7d741b2948bd5d79ac17fdfbfe268ccf Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Tue, 1 Sep 2020 14:19:01 -0500 Subject: [PATCH 25/25] fix the merge fix --- .../xpack/ilm/TimeSeriesLifecycleActionsIT.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java b/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java index c202894d7ccd7..c2695cbac36e9 100644 --- a/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java +++ b/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java @@ -116,7 +116,7 @@ public void testFullPolicy() throws Exception { String secondIndex = index + "-000002"; createIndexWithSettings(client(), originalIndex, alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 4) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) - .put("index.routing.allocation.include._name", "integTest-0") + .put("index.routing.allocation.include._name", "javaRestTest-0") .put(RolloverAction.LIFECYCLE_ROLLOVER_ALIAS, alias)); // create policy @@ -144,7 +144,7 @@ public void testMoveToAllocateStep() throws Exception { String originalIndex = index + "-000001"; createIndexWithSettings(client(), originalIndex, alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 4) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) - .put("index.routing.allocation.include._name", "integTest-0") + .put("index.routing.allocation.include._name", "javaRestTest-0") .put(RolloverAction.LIFECYCLE_ROLLOVER_ALIAS, "alias")); // create policy @@ -178,7 +178,7 @@ public void testMoveToRolloverStep() throws Exception { String secondIndex = index + "-000002"; createIndexWithSettings(client(), originalIndex, alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 4) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) - .put("index.routing.allocation.include._name", "integTest-0") + .put("index.routing.allocation.include._name", "javaRestTest-0") .put(RolloverAction.LIFECYCLE_ROLLOVER_ALIAS, alias)); createFullPolicy(client(), policy, TimeValue.timeValueHours(10)); @@ -355,7 +355,7 @@ public void testRolloverActionWithIndexingComplete() throws Exception { public void testAllocateOnlyAllocation() throws Exception { createIndexWithSettings(client(), index, alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 2) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)); - String allocateNodeName = "integTest-" + randomFrom(0, 1); + String allocateNodeName = "javaRestTest-" + randomFrom(0, 1); AllocateAction allocateAction = new AllocateAction(null, null, null, singletonMap("_name", allocateNodeName)); String endPhase = randomFrom("warm", "cold"); createNewSingletonPolicy(client(), policy, endPhase, allocateAction); @@ -617,7 +617,7 @@ public void testShrinkDuringSnapshot() throws Exception { .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 2) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) // required so the shrink doesn't wait on SetSingleNodeAllocateStep - .put(IndexMetadata.INDEX_ROUTING_REQUIRE_GROUP_SETTING.getKey() + "_name", "integTest-0")); + .put(IndexMetadata.INDEX_ROUTING_REQUIRE_GROUP_SETTING.getKey() + "_name", "javaRestTest-0")); // index document so snapshot actually does something indexDocument(client(), index); // start snapshot