Skip to content

Commit

Permalink
[7.x] Convert first 1/2 x-pack plugins from integTest to [yaml | java…
Browse files Browse the repository at this point in the history
…]RestTest or internalClusterTest (#60630) (#61855)

For 1/2 the plugins in x-pack, the integTest
task is now a no-op and all of the tests are now executed via a test,
yamlRestTest, javaRestTest, or internalClusterTest.

This includes the following projects:
async-search, autoscaling, ccr, enrich, eql, frozen-indicies,
data-streams, graph, ilm, mapper-constant-keyword, mapper-flattened, ml

A few of the more specialized qa projects within these plugins
have not been changed with this PR due to additional complexity which should
be addressed separately.

A follow up PR will address the remaining x-pack plugins (this PR is big enough as-is).

related: #61802
related: #56841
related: #59939
related: #55896
  • Loading branch information
jakelandis authored Sep 2, 2020
1 parent 6eacb6d commit 794aac7
Show file tree
Hide file tree
Showing 164 changed files with 277 additions and 347 deletions.
11 changes: 2 additions & 9 deletions x-pack/plugin/async-search/qa/rest/build.gradle
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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
12 changes: 5 additions & 7 deletions x-pack/plugin/async-search/qa/security/build.gradle
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Integer> failedShards = new HashSet<>();
Expand Down
6 changes: 0 additions & 6 deletions x-pack/plugin/autoscaling/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
17 changes: 3 additions & 14 deletions x-pack/plugin/autoscaling/qa/rest/build.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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'
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public AutoscalingRestIT(final ClientYamlTestCandidate testCandidate) {

@ParametersFactory
public static Iterable<Object[]> parameters() throws Exception {
return ESClientYamlSuiteTestCase.createParameters();
return createParameters();
}

@Override
Expand Down
17 changes: 3 additions & 14 deletions x-pack/plugin/ccr/qa/rest/build.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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
Expand All @@ -33,5 +24,3 @@ testClusters.restTest {
user username: 'ccr-user', password: 'ccr-user-password', role: 'superuser'
}

check.dependsOn restTest
test.enabled = false
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -27,7 +25,7 @@ public CcrRestIT(final ClientYamlTestCandidate testCandidate) {

@ParametersFactory
public static Iterable<Object[]> parameters() throws Exception {
return ESClientYamlSuiteTestCase.createParameters();
return createParameters();
}

@Override
Expand All @@ -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"));
}

}
8 changes: 0 additions & 8 deletions x-pack/plugin/data-streams/qa/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +0,0 @@
import org.elasticsearch.gradle.test.RestIntegTestTask

apply plugin: 'elasticsearch.build'
test.enabled = false

dependencies {
api project(':test:framework')
}
12 changes: 3 additions & 9 deletions x-pack/plugin/data-streams/qa/multi-node/build.gradle
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
11 changes: 2 additions & 9 deletions x-pack/plugin/data-streams/qa/rest/build.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public DataStreamsRestIT(final ClientYamlTestCandidate testCandidate) {

@ParametersFactory
public static Iterable<Object[]> parameters() throws Exception {
return ESClientYamlSuiteTestCase.createParameters();
return createParameters();
}

}
11 changes: 4 additions & 7 deletions x-pack/plugin/enrich/qa/rest-with-security/build.gradle
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
11 changes: 4 additions & 7 deletions x-pack/plugin/enrich/qa/rest/build.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public EnrichRestIT(final ClientYamlTestCandidate testCandidate) {

@ParametersFactory
public static Iterable<Object[]> parameters() throws Exception {
return ESClientYamlSuiteTestCase.createParameters();
return createParameters();
}

}
13 changes: 4 additions & 9 deletions x-pack/plugin/eql/qa/rest/build.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public EqlRestIT(final ClientYamlTestCandidate testCandidate) {

@ParametersFactory
public static Iterable<Object[]> parameters() throws Exception {
return ESClientYamlSuiteTestCase.createParameters();
return createParameters();
}

}
11 changes: 3 additions & 8 deletions x-pack/plugin/eql/qa/security/build.gradle
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugin/frozen-indices/build.gradle
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugin/graph/build.gradle
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
9 changes: 3 additions & 6 deletions x-pack/plugin/graph/qa/with-security/build.gradle
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -18,7 +15,7 @@ restResources {
}
}

testClusters.integTest {
testClusters.all {
testDistribution = 'DEFAULT'
setting 'xpack.security.enabled', 'true'
setting 'xpack.license.self_generated.type', 'trial'
Expand Down
Loading

0 comments on commit 794aac7

Please sign in to comment.