2017-09-14 17:57:28 -04:00
|
|
|
import org.elasticsearch.gradle.LoggedExec
|
2018-06-05 19:56:22 -04:00
|
|
|
import org.elasticsearch.gradle.plugin.PluginBuildPlugin
|
2017-02-11 12:12:26 -05:00
|
|
|
import org.elasticsearch.gradle.test.NodeInfo
|
2016-11-21 04:52:55 -05:00
|
|
|
|
2016-09-29 06:03:14 -04:00
|
|
|
import java.nio.charset.StandardCharsets
|
2016-07-25 20:09:54 -04:00
|
|
|
|
2019-06-20 02:21:29 -04:00
|
|
|
apply plugin: 'elasticsearch.testclusters'
|
2018-05-16 18:35:57 -04:00
|
|
|
apply plugin: 'elasticsearch.standalone-rest-test'
|
|
|
|
apply plugin: 'elasticsearch.rest-test'
|
2016-09-29 06:03:14 -04:00
|
|
|
|
2018-02-07 22:21:43 -05:00
|
|
|
archivesBaseName = 'x-pack'
|
2016-09-29 06:03:14 -04:00
|
|
|
|
2018-01-20 00:30:17 -05:00
|
|
|
dependencies {
|
2018-01-27 00:48:30 -05:00
|
|
|
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts')
|
2017-10-09 06:06:12 -04:00
|
|
|
}
|
|
|
|
|
2018-06-05 19:56:22 -04:00
|
|
|
subprojects {
|
|
|
|
afterEvaluate {
|
|
|
|
if (project.plugins.hasPlugin(PluginBuildPlugin)) {
|
|
|
|
// see the root Gradle file for additional logic regarding this configuration
|
|
|
|
project.configurations.create('featureAwarePlugin')
|
|
|
|
project.dependencies.add('featureAwarePlugin', project.configurations.compileClasspath)
|
2019-06-04 16:50:23 -04:00
|
|
|
project.dependencies.add('featureAwarePlugin', project(':x-pack:test:feature-aware'))
|
2018-06-05 19:56:22 -04:00
|
|
|
project.dependencies.add('featureAwarePlugin', project.sourceSets.main.output.getClassesDirs())
|
|
|
|
|
2019-06-20 02:21:29 -04:00
|
|
|
File successMarker = file("$buildDir/markers/featureAware")
|
|
|
|
task featureAwareCheck(type: LoggedExec) {
|
2018-06-05 19:56:22 -04:00
|
|
|
description = "Runs FeatureAwareCheck on main classes."
|
|
|
|
dependsOn project.configurations.featureAwarePlugin
|
|
|
|
outputs.file(successMarker)
|
|
|
|
|
2019-06-20 02:21:29 -04:00
|
|
|
executable = "${project.runtimeJavaHome}/bin/java"
|
2018-06-05 19:56:22 -04:00
|
|
|
|
|
|
|
// default to main class files if such a source set exists
|
|
|
|
final List files = []
|
|
|
|
if (project.sourceSets.findByName("main")) {
|
2018-06-29 15:17:19 -04:00
|
|
|
files.add(project.sourceSets.main.output.classesDirs)
|
2018-06-05 19:56:22 -04:00
|
|
|
dependsOn project.tasks.classes
|
|
|
|
}
|
|
|
|
// filter out non-existent classes directories from empty source sets
|
|
|
|
final FileCollection classDirectories = project.files(files).filter { it.exists() }
|
|
|
|
|
|
|
|
doFirst {
|
2018-06-14 11:07:29 -04:00
|
|
|
args('-cp', project.configurations.featureAwarePlugin.asPath, 'org.elasticsearch.xpack.test.feature_aware.FeatureAwareCheck')
|
2018-06-05 19:56:22 -04:00
|
|
|
classDirectories.each { args it.getAbsolutePath() }
|
|
|
|
}
|
|
|
|
doLast {
|
|
|
|
successMarker.parentFile.mkdirs()
|
|
|
|
successMarker.setText("", 'UTF-8')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-20 02:21:29 -04:00
|
|
|
project.precommit.dependsOn featureAwareCheck
|
2018-06-05 19:56:22 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-20 00:30:17 -05:00
|
|
|
// https://github.com/elastic/x-plugins/issues/724
|
|
|
|
configurations {
|
|
|
|
testArtifacts.extendsFrom testRuntime
|
2017-04-10 07:40:07 -04:00
|
|
|
}
|
|
|
|
|
2018-01-20 00:30:17 -05:00
|
|
|
task testJar(type: Jar) {
|
|
|
|
appendix 'test'
|
|
|
|
from sourceSets.test.output
|
2018-04-25 09:38:31 -04:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
* tests happy.
|
|
|
|
*/
|
|
|
|
metaInf {
|
|
|
|
from(project.licenseFile.parent) {
|
|
|
|
include project.licenseFile.name
|
|
|
|
rename { 'LICENSE.txt' }
|
|
|
|
}
|
|
|
|
from(project.noticeFile.parent) {
|
|
|
|
include project.noticeFile.name
|
|
|
|
}
|
|
|
|
}
|
2016-02-03 11:21:55 -05:00
|
|
|
}
|
2018-01-20 00:30:17 -05:00
|
|
|
artifacts {
|
|
|
|
testArtifacts testJar
|
2016-09-29 06:03:14 -04:00
|
|
|
}
|
|
|
|
|
2018-07-24 05:48:14 -04:00
|
|
|
// location for keys and certificates
|
2019-06-20 02:21:29 -04:00
|
|
|
File keystoreDir = file("$buildDir/keystore")
|
2018-07-24 05:48:14 -04:00
|
|
|
File nodeKey = file("$keystoreDir/testnode.pem")
|
|
|
|
File nodeCert = file("$keystoreDir/testnode.crt")
|
|
|
|
|
|
|
|
// Add key and certs to test classpath: it expects them there
|
|
|
|
// User cert and key PEM files instead of a JKS Keystore for the cluster's trust material so that
|
|
|
|
// it can run in a FIPS 140 JVM
|
|
|
|
// TODO: Remove all existing uses of cross project file references when the new approach for referencing static files is available
|
|
|
|
// https://github.com/elastic/elasticsearch/pull/32201
|
|
|
|
task copyKeyCerts(type: Copy) {
|
|
|
|
from(project(':x-pack:plugin:core').file('src/test/resources/org/elasticsearch/xpack/security/transport/ssl/certs/simple/')) {
|
|
|
|
include 'testnode.crt', 'testnode.pem'
|
2017-09-14 17:57:28 -04:00
|
|
|
}
|
2018-07-24 05:48:14 -04:00
|
|
|
into keystoreDir
|
2017-09-14 17:57:28 -04:00
|
|
|
}
|
|
|
|
// Add keystores to test classpath: it expects it there
|
|
|
|
sourceSets.test.resources.srcDir(keystoreDir)
|
2018-07-24 05:48:14 -04:00
|
|
|
processTestResources.dependsOn(copyKeyCerts)
|
2017-09-14 17:57:28 -04:00
|
|
|
|
2019-06-20 02:21:29 -04:00
|
|
|
integTest.runner {
|
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
systemProperty 'es.set.netty.runtime.available.processors', 'false'
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: fix this rest test to not depend on a hardcoded port!
|
|
|
|
def blacklist = ['getting_started/10_monitor_cluster_health/*']
|
|
|
|
boolean snapshot = Boolean.valueOf(System.getProperty("build.snapshot", "true"))
|
|
|
|
if (!snapshot) {
|
|
|
|
// these tests attempt to install basic/internal licenses signed against the dev/public.key
|
|
|
|
// Since there is no infrastructure in place (anytime soon) to generate licenses using the production
|
|
|
|
// private key, these tests are whitelisted in non-snapshot test runs
|
|
|
|
blacklist.addAll(['xpack/15_basic/*', 'license/20_put_license/*'])
|
|
|
|
}
|
|
|
|
systemProperty 'tests.rest.blacklist', blacklist.join(',')
|
2018-07-24 05:48:14 -04:00
|
|
|
dependsOn copyKeyCerts
|
2019-06-20 02:21:29 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
testClusters.integTest {
|
2019-07-15 20:53:05 -04:00
|
|
|
testDistribution = 'DEFAULT' // this is important since we use the reindex module in ML
|
2017-02-22 03:56:52 -05:00
|
|
|
setting 'xpack.ml.enabled', 'true'
|
2018-03-21 23:09:44 -04:00
|
|
|
setting 'xpack.security.enabled', 'true'
|
2017-04-04 08:44:40 -04:00
|
|
|
// Integration tests are supposed to enable/disable exporters before/after each test
|
|
|
|
setting 'xpack.monitoring.exporters._local.type', 'local'
|
|
|
|
setting 'xpack.monitoring.exporters._local.enabled', 'false'
|
2017-08-23 06:21:30 -04:00
|
|
|
setting 'xpack.security.authc.token.enabled', 'true'
|
2019-02-04 22:21:57 -05:00
|
|
|
setting 'xpack.security.authc.api_key.enabled', 'true'
|
2017-09-14 17:57:28 -04:00
|
|
|
setting 'xpack.security.transport.ssl.enabled', 'true'
|
2018-07-24 05:48:14 -04:00
|
|
|
setting 'xpack.security.transport.ssl.key', nodeKey.name
|
|
|
|
setting 'xpack.security.transport.ssl.certificate', nodeCert.name
|
2017-09-14 17:57:28 -04:00
|
|
|
setting 'xpack.security.transport.ssl.verification_mode', 'certificate'
|
2017-11-22 10:35:18 -05:00
|
|
|
setting 'xpack.security.audit.enabled', 'true'
|
2018-02-12 14:57:04 -05:00
|
|
|
setting 'xpack.license.self_generated.type', 'trial'
|
2019-06-20 02:21:29 -04:00
|
|
|
keystore 'bootstrap.password', 'x-pack-test-password'
|
|
|
|
keystore 'xpack.security.transport.ssl.secure_key_passphrase', 'testnode'
|
2017-07-13 20:59:50 -04:00
|
|
|
|
2019-06-20 02:21:29 -04:00
|
|
|
user username: "x_pack_rest_user", password: "x-pack-test-password"
|
2018-07-24 05:48:14 -04:00
|
|
|
extraConfigFile nodeKey.name, nodeKey
|
|
|
|
extraConfigFile nodeCert.name, nodeCert
|
2018-06-26 09:49:03 -04:00
|
|
|
}
|
|
|
|
|