Skip to content

Commit

Permalink
Remove integTest task from PluginBuildPlugin (#61879)
Browse files Browse the repository at this point in the history
This commit removes `integTest` task from all es-plugins.  
Most relevant projects have been converted to use yamlRestTest, javaRestTest, 
or internalClusterTest in prior PRs. 

A few projects needed to be adjusted to allow complete removal of this task
* x-pack/plugin - converted to use yamlRestTest and javaRestTest 
* plugins/repository-hdfs - kept the integTest task, but use `rest-test` plugin to define the task
* qa/die-with-dignity - convert to javaRestTest
* x-pack/qa/security-example-spi-extension - convert to javaRestTest
* multiple projects - remove the integTest.enabled = false (yay!)

related: #61802
related: #60630
related: #59444
related: #59089
related: #56841
related: #59939
related: #55896
  • Loading branch information
jakelandis authored Sep 8, 2020
1 parent 0684ebc commit 1367bd0
Show file tree
Hide file tree
Showing 52 changed files with 58 additions and 190 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.VersionProperties
import org.elasticsearch.gradle.dependencies.CompileOnlyResolvePlugin
import org.elasticsearch.gradle.info.BuildParams
import org.elasticsearch.gradle.test.RestIntegTestTask
import org.elasticsearch.gradle.test.RestTestBasePlugin
import org.elasticsearch.gradle.testclusters.RunTask
import org.elasticsearch.gradle.util.Util
Expand Down Expand Up @@ -60,16 +59,7 @@ class PluginBuildPlugin implements Plugin<Project> {
boolean isXPackModule = project.path.startsWith(':x-pack:plugin')
boolean isModule = project.path.startsWith(':modules:') || isXPackModule

createIntegTestTask(project)
createBundleTasks(project, extension)
project.tasks.named("integTest").configure {
it.dependsOn(project.tasks.named("bundlePlugin"))
}
if (isModule) {
project.testClusters.integTest.module(project.tasks.bundlePlugin.archiveFile)
} else {
project.testClusters.integTest.plugin(project.tasks.bundlePlugin.archiveFile)
}

project.afterEvaluate {
project.extensions.getByType(PluginPropertiesExtension).extendedPlugins.each { pluginName ->
Expand Down Expand Up @@ -116,14 +106,6 @@ class PluginBuildPlugin implements Plugin<Project> {
}
}

//disable integTest task if project has been converted to use yaml or java rest test plugin
project.pluginManager.withPlugin("elasticsearch.yaml-rest-test") {
project.tasks.integTest.enabled = false
}
project.pluginManager.withPlugin("elasticsearch.java-rest-test") {
project.tasks.integTest.enabled = false
}

project.tasks.named('testingConventions').configure {
naming.clear()
naming {
Expand All @@ -142,7 +124,6 @@ class PluginBuildPlugin implements Plugin<Project> {
// allow running ES with this plugin in the foreground of a build
project.tasks.register('run', RunTask) {
dependsOn(project.tasks.bundlePlugin)
useCluster project.testClusters.integTest
}
}

Expand Down Expand Up @@ -172,13 +153,6 @@ class PluginBuildPlugin implements Plugin<Project> {
}
}

/** Adds an integTest task which runs rest tests */
private static void createIntegTestTask(Project project) {
RestIntegTestTask integTest = project.tasks.create('integTest', RestIntegTestTask.class)
integTest.mustRunAfter('precommit', 'test')
project.check.dependsOn(integTest)
}

/**
* Adds a bundlePlugin task which builds the zip containing the plugin jars,
* metadata, properties, and packaging files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void testApply() {
);
assertNotNull("plugin extensions has the right type", project.getExtensions().findByType(PluginPropertiesExtension.class));

assertNotNull("plugin created an integTest class", project.getTasks().findByName("integTest"));
assertNull("plugin should not create the integTest task", project.getTasks().findByName("integTest"));
}

@Ignore("https://github.com/elastic/elasticsearch/issues/47123")
Expand Down
1 change: 0 additions & 1 deletion client/client-benchmark-noop-api-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,3 @@ dependenciesInfo.enabled = false

// no unit tests
test.enabled = false
integTest.enabled = false
4 changes: 0 additions & 4 deletions distribution/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,6 @@ project.rootProject.subprojects.findAll { it.parent.path == ':modules' }.each {
copyLog4jProperties(buildOssLog4jConfig, module)
copyLog4jProperties(buildDefaultLog4jConfig, module)

// make sure the module's integration tests run after the integ-test-zip (ie rest tests)
module.afterEvaluate({
module.integTest.mustRunAfter(':distribution:archives:integ-test-zip:integTest')
})
restTestExpansions['expected.modules.count'] += 1
}

Expand Down
2 changes: 0 additions & 2 deletions modules/lang-expression/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ restResources {
}
}

integTest.enabled = false

tasks.named("dependencyLicenses").configure {
mapping from: /lucene-.*/, to: 'lucene'
mapping from: /asm-.*/, to: 'asm'
Expand Down
2 changes: 0 additions & 2 deletions modules/lang-painless/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ restResources {
}
}

integTest.enabled = false

tasks.named("test").configure {
// in WhenThingsGoWrongTests we intentionally generate an out of memory error, this prevents the heap from being dumped to disk
jvmArgs '-XX:-OmitStackTraceInFastThrow', '-XX:-HeapDumpOnOutOfMemoryError'
Expand Down
1 change: 0 additions & 1 deletion modules/systemd/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,3 @@ esplugin {
classname 'org.elasticsearch.systemd.SystemdPlugin'
}

integTest.enabled = false
9 changes: 9 additions & 0 deletions plugins/repository-hdfs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import static org.elasticsearch.gradle.PropertyNormalization.IGNORE_VALUE

apply plugin: 'elasticsearch.test.fixtures'
apply plugin: 'elasticsearch.rest-resources'
apply plugin: 'elasticsearch.rest-test'

esplugin {
description 'The HDFS repository plugin adds support for Hadoop Distributed File-System (HDFS) repositories.'
Expand Down Expand Up @@ -94,6 +95,14 @@ tasks.named("dependencyLicenses").configure {
mapping from: /hadoop-.*/, to: 'hadoop'
}

tasks.named("integTest").configure {
it.dependsOn(project.tasks.named("bundlePlugin"))
}

testClusters.integTest {
plugin(project.tasks.bundlePlugin.archiveFile)
}

String realm = "BUILD.ELASTIC.CO"
String krb5conf = project(':test:fixtures:krb5kdc-fixture').ext.krb5Conf("hdfs")

Expand Down
2 changes: 0 additions & 2 deletions plugins/transport-nio/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ esplugin {
classname 'org.elasticsearch.transport.nio.NioTransportPlugin'
}

// integTest have been converted to internalClusterTest
integTest.enabled = false
dependencies {
api project(':libs:elasticsearch-nio')

Expand Down
33 changes: 9 additions & 24 deletions qa/die-with-dignity/build.gradle
Original file line number Diff line number Diff line change
@@ -1,43 +1,28 @@
import org.elasticsearch.gradle.info.BuildParams

/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.java-rest-test'
apply plugin: 'elasticsearch.esplugin'

esplugin {
description 'Die with dignity plugin'
classname 'org.elasticsearch.DieWithDignityPlugin'
}

integTest {
dependencies {
// let the javaRestTest see the classpath of main
javaRestTestImplementation project.sourceSets.main.runtimeClasspath
}

javaRestTest {
systemProperty 'tests.security.manager', 'false'
systemProperty 'tests.system_call_filter', 'false'
nonInputProperties.systemProperty 'log', "${-> testClusters.integTest.singleNode().getServerLog()}"
nonInputProperties.systemProperty 'log', "${-> testClusters.javaRestTest.singleNode().getServerLog()}"
systemProperty 'runtime.java.home', BuildParams.runtimeJavaHome
}

testClusters.integTest {
testClusters.javaRestTest {
systemProperty "die.with.dignity.test", "whatever"
}

test.enabled = false

check.dependsOn integTest
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
Expand Down Expand Up @@ -63,13 +63,13 @@ public void testDieWithDignity() throws Exception {
try {
while (it.hasNext() && (fatalError == false || fatalErrorInThreadExiting == false)) {
final String line = it.next();
if (containsAll(line, ".*ERROR.*", ".*ExceptionsHelper.*", ".*integTest-0.*", ".*fatal error.*")) {
if (containsAll(line, ".*ERROR.*", ".*ExceptionsHelper.*", ".*javaRestTest-0.*", ".*fatal error.*")) {
fatalError = true;
} else if (containsAll(
line,
".*ERROR.*",
".*ElasticsearchUncaughtExceptionHandler.*",
".*integTest-0.*",
".*javaRestTest-0.*",
".*fatal error in thread \\[Thread-\\d+\\], exiting.*",
".*java.lang.OutOfMemoryError: die with dignity.*"
)) {
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugin/analytics/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ dependencies {
api 'org.apache.commons:commons-math3:3.2'
}

integTest.enabled = false
1 change: 0 additions & 1 deletion x-pack/plugin/async-search/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@ dependencies {
testImplementation project(path: xpackModule('async'))
}

integTest.enabled = false

2 changes: 1 addition & 1 deletion x-pack/plugin/async/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ dependencyLicenses {
tasks.named("test").configure {
enabled = false
}
integTest.enabled = false


2 changes: 0 additions & 2 deletions x-pack/plugin/autoscaling/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ esplugin {
}
archivesBaseName = 'x-pack-autoscaling'

integTest.enabled = false

tasks.named('internalClusterTest').configure {
if (BuildParams.isSnapshotBuild() == false) {
systemProperty 'es.autoscaling_feature_flag_registered', 'true'
Expand Down
29 changes: 19 additions & 10 deletions x-pack/plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -1,37 +1,46 @@
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'
apply plugin: 'elasticsearch.validate-rest-spec'

archivesBaseName = 'x-pack'

dependencies {
testImplementation project(xpackModule('core')) // this redundant dependency is here to make IntelliJ happy
testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts')
yamlRestTestImplementation project(xpackModule('core')) // this redundant dependency is here to make IntelliJ happy
yamlRestTestImplementation project(path: xpackModule('core'), configuration: 'testArtifacts')
javaRestTestImplementation project(path: xpackModule('core'), configuration: 'testArtifacts')
}

configurations {
testArtifacts.extendsFrom testRuntime
testArtifacts.extendsFrom testImplementation
testArtifacts.extendsFrom yamlRestTestImplementation
testArtifacts.extendsFrom javaRestTestImplementation
}

restResources {
restApi {
includeCore '*'
includeXpack '*'
}
restTests {
includeXpack '*'
}
}

//The api and tests need to stay at src/test/... since some external tooling depends on that exact file path.
artifacts {
restXpackSpecs(new File(projectDir, "src/test/resources/rest-api-spec/api"))
restXpackTests(new File(projectDir, "src/test/resources/rest-api-spec/test"))
}

def testJar = tasks.register("testJar", Jar) {
appendix 'test'
duplicatesStrategy = DuplicatesStrategy.INCLUDE
from sourceSets.test.output
from sourceSets.yamlRestTest.output
from sourceSets.javaRestTest.output
/*
* Stick the license and notice file in the jar. This isn't strictly
* needed because we don't publish it but it makes our super-paranoid
Expand Down Expand Up @@ -68,10 +77,10 @@ tasks.register("copyKeyCerts", Copy) {
into keystoreDir
}
// Add keystores to test classpath: it expects it there
sourceSets.test.resources.srcDir(keystoreDir)
processTestResources.dependsOn("copyKeyCerts")
sourceSets.yamlRestTest.resources.srcDir(keystoreDir)
processYamlRestTestResources.dependsOn("copyKeyCerts")

integTest {
yamlRestTest {
/*
* We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
* other if we allow them to set the number of available processors as it's set-once in Netty.
Expand All @@ -91,7 +100,7 @@ integTest {
dependsOn copyKeyCerts
}

testClusters.integTest {
testClusters.all {
testDistribution = 'DEFAULT' // this is important since we use the reindex module in ML
setting 'xpack.ml.enabled', 'true'
setting 'xpack.security.enabled', 'true'
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugin/ccr/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ esplugin {
}
archivesBaseName = 'x-pack-ccr'

integTest.enabled = false

// Integration Test classes that cannot run with the security manager
String[] noSecurityManagerITClasses = ["**/CloseFollowerIndexIT.class"]

Expand Down
1 change: 0 additions & 1 deletion x-pack/plugin/data-streams/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ esplugin {
extendedPlugins = ['x-pack-core']
}
archivesBaseName = 'x-pack-data-streams'
integTest.enabled = false

dependencies {
compileOnly project(path: xpackModule('core'), configuration: 'default')
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugin/deprecation/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@ dependencies {
compileOnly project(":x-pack:plugin:core")
}

integTest.enabled = false
3 changes: 0 additions & 3 deletions x-pack/plugin/enrich/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ dependencies {
testImplementation project(path: xpackModule('monitoring'), configuration: 'testArtifacts')
}

// No real integ tests in the module:
integTest.enabled = false

// add all sub-projects of the qa sub-project
gradle.projectsEvaluated {
project.subprojects
Expand Down
3 changes: 0 additions & 3 deletions x-pack/plugin/eql/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ ext {

archivesBaseName = 'x-pack-eql'

// All integration tests live in qa modules
integTest.enabled = false

dependencies {
compileOnly project(path: xpackModule('core'), configuration: 'default')
compileOnly(project(':modules:lang-painless')) {
Expand Down
5 changes: 0 additions & 5 deletions x-pack/plugin/frozen-indices/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,3 @@ dependencies {
compileOnly project(path: xpackModule('core'), configuration: 'default')
testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts')
}

// 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
integTest.enabled = false
1 change: 0 additions & 1 deletion x-pack/plugin/graph/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,3 @@ gradle.projectsEvaluated {
.each { check.dependsOn it.check }
}

integTest.enabled = false
5 changes: 0 additions & 5 deletions x-pack/plugin/identity-provider/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,6 @@ internalClusterTest {
}


// 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
integTest.enabled = false

// add all sub-projects of the qa sub-project
gradle.projectsEvaluated {
project.subprojects
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugin/ilm/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,3 @@ gradle.projectsEvaluated {
.each { check.dependsOn it.check }
}

integTest.enabled = false
Loading

0 comments on commit 1367bd0

Please sign in to comment.