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/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 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<>(); 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" - } -} diff --git a/x-pack/plugin/autoscaling/qa/rest/build.gradle b/x-pack/plugin/autoscaling/qa/rest/build.gradle index 4d46ca4f4ea05..bdfa4886ab961 100644 --- a/x-pack/plugin/autoscaling/qa/rest/build.gradle +++ b/x-pack/plugin/autoscaling/qa/rest/build.gradle @@ -1,13 +1,9 @@ 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') } restResources { @@ -17,11 +13,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 +24,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 diff --git a/x-pack/plugin/ccr/qa/rest/build.gradle b/x-pack/plugin/ccr/qa/rest/build.gradle index 925fdb0972187..ee65d86b50112 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,10 @@ 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') } -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 +24,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 81% 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..7e2e7cf9d7fde 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 @@ -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; @@ -27,7 +25,7 @@ public CcrRestIT(final ClientYamlTestCandidate testCandidate) { @ParametersFactory public static Iterable parameters() throws Exception { - return ESClientYamlSuiteTestCase.createParameters(); + return createParameters(); } @Override @@ -38,12 +36,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("indices:data/read/xpack/ccr/shard_changes")); } } 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 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..d8ca1d93e881f 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,15 @@ import org.elasticsearch.gradle.info.BuildParams -apply plugin: 'elasticsearch.testclusters' -apply plugin: 'elasticsearch.standalone-rest-test' -apply plugin: 'elasticsearch.rest-test' - -dependencies { - testImplementation project(path: xpackProject('plugin').path, configuration: 'testArtifacts') -} +apply plugin: 'elasticsearch.java-rest-test' 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 6d32034af5941..9bf3faf0c8256 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 { @@ -10,11 +7,7 @@ restResources { } } -dependencies { - testImplementation project(path: xpackModule('data-streams')) -} - -testClusters.integTest { +testClusters.all { testDistribution = 'DEFAULT' setting 'xpack.license.self_generated.type', 'basic' // disable ILM history, since it disturbs tests using _all diff --git a/x-pack/plugin/data-streams/qa/rest/src/test/java/org/elasticsearch/xpack/datastreams/DataStreamUpgradeRestIT.java b/x-pack/plugin/data-streams/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/datastreams/DataStreamUpgradeRestIT.java similarity index 100% rename from x-pack/plugin/data-streams/qa/rest/src/test/java/org/elasticsearch/xpack/datastreams/DataStreamUpgradeRestIT.java rename to x-pack/plugin/data-streams/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/datastreams/DataStreamUpgradeRestIT.java 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/rest-with-security/build.gradle b/x-pack/plugin/enrich/qa/rest-with-security/build.gradle index 901a4a885570f..6b091d3fa64aa 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,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(path: xpackModule('enrich')) - testImplementation project(path: xpackModule('core')) - testImplementation project(path: xpackModule('enrich:qa:common')) + 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..cac82efd43003 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,10 @@ restResources { } dependencies { - testImplementation project(path: xpackModule('enrich')) - testImplementation project(path: xpackModule('enrich:qa:common')) + javaRestTestImplementation project(path: xpackModule('enrich:qa:common')) } -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 diff --git a/x-pack/plugin/eql/qa/rest/build.gradle b/x-pack/plugin/eql/qa/rest/build.gradle index c89447234ebbb..041015b6b6547 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')) } -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 92% 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 5443715d735a1..98edaaec4409d 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 @@ -19,7 +19,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 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 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 diff --git a/x-pack/plugin/identity-provider/build.gradle b/x-pack/plugin/identity-provider/build.gradle index a7348f0bb2390..fdda23372b28f 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' @@ -351,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 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) + "/"; + } +} 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 98% 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 index fe7d2d941baa8..043a66948b4aa 100644 --- 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 @@ -156,11 +156,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(25)); - 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 frozenActions = new HashMap<>(); frozenActions.put(SetPriorityAction.NAME, new SetPriorityAction(0)); Map phases = new HashMap<>(); 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 96% 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 index 76443b5257a31..963a86d3693c9 100644 --- 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 @@ -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/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 100% 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 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 99% 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 0260928ab36fb..c2695cbac36e9 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 @@ -105,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)); } @@ -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 @@ -652,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" + @@ -1331,8 +1331,8 @@ public void testWaitForActiveShardsStep() throws Exception { String originalIndex = index + "-000001"; String secondIndex = index + "-000002"; 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), + .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) + .put(RolloverAction.LIFECYCLE_ROLLOVER_ALIAS, alias), true); // create policy @@ -1779,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())); diff --git a/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/ilm/actions/SearchableSnapshotActionIT.java b/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/actions/SearchableSnapshotActionIT.java similarity index 100% rename from x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/ilm/actions/SearchableSnapshotActionIT.java rename to x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/actions/SearchableSnapshotActionIT.java 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 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 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 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 3a143607673dd..93f943d7ddfc8 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..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,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: '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')) + 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 @@ -23,10 +21,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 +33,7 @@ integTest { systemProperty 'es.set.netty.runtime.available.processors', 'false' } -testClusters.integTest { +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/javaRestTest/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/javaRestTest/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/javaRestTest/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/javaRestTest/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/javaRestTest/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/javaRestTest/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/javaRestTest/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/javaRestTest/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/javaRestTest/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/javaRestTest/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/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/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/test/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/test/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/test/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/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 49cdaa958e318..25c9fa8b3cecf 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/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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/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 ae222c6eb9dd4..e418296178bca 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 { @@ -580,7 +582,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/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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/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/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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/test/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 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 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/integration/InferenceProcessorIT.java b/x-pack/plugin/ml/qa/single-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/InferenceProcessorIT.java similarity index 100% rename from x-pack/plugin/ml/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/InferenceProcessorIT.java rename to x-pack/plugin/ml/qa/single-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/InferenceProcessorIT.java 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) {