2017-06-16 11:44:51 -04:00
|
|
|
import org.elasticsearch.gradle.Version
|
2019-10-04 09:12:53 -04:00
|
|
|
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask
|
2017-06-16 11:44:51 -04:00
|
|
|
|
|
|
|
|
2019-10-04 09:12:53 -04:00
|
|
|
apply plugin: 'elasticsearch.testclusters'
|
2019-04-01 16:23:24 -04:00
|
|
|
apply plugin: 'elasticsearch.standalone-test'
|
|
|
|
|
2017-06-16 11:44:51 -04:00
|
|
|
dependencies {
|
2019-04-15 13:14:43 -04:00
|
|
|
// TODO: Remove core dependency and change tests to not use builders that are part of xpack-core.
|
|
|
|
// Currently needed for ml tests are using the building for datafeed and job config)
|
2018-01-27 00:48:30 -05:00
|
|
|
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts')
|
2019-04-15 13:14:43 -04:00
|
|
|
|
2019-04-08 10:05:12 -04:00
|
|
|
testCompile project(path: ':qa:full-cluster-restart', configuration: 'testArtifacts')
|
2019-04-15 13:14:43 -04:00
|
|
|
testCompile project(':x-pack:qa')
|
2017-06-16 11:44:51 -04:00
|
|
|
}
|
|
|
|
|
2017-09-08 15:33:33 -04:00
|
|
|
licenseHeaders {
|
|
|
|
approvedLicenses << 'Apache'
|
|
|
|
}
|
|
|
|
|
2018-12-11 07:15:44 -05:00
|
|
|
forbiddenPatterns {
|
|
|
|
exclude '**/system_key'
|
|
|
|
}
|
2019-01-08 06:39:03 -05:00
|
|
|
|
2019-04-01 16:23:24 -04:00
|
|
|
String outputDir = "${buildDir}/generated-resources/${project.name}"
|
2017-06-16 11:44:51 -04:00
|
|
|
|
2019-10-04 09:12:53 -04:00
|
|
|
tasks.register("bwcTest") {
|
2017-06-16 11:44:51 -04:00
|
|
|
description = 'Runs backwards compatibility tests.'
|
|
|
|
group = 'verification'
|
2019-04-01 16:23:24 -04:00
|
|
|
}
|
2017-06-16 11:44:51 -04:00
|
|
|
|
2019-10-04 09:12:53 -04:00
|
|
|
tasks.register("copyTestNodeKeyMaterial", Copy) {
|
|
|
|
from project(':x-pack:plugin:core')
|
|
|
|
.files(
|
|
|
|
'src/test/resources/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.pem',
|
|
|
|
'src/test/resources/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.crt'
|
|
|
|
)
|
2017-06-16 11:44:51 -04:00
|
|
|
into outputDir
|
2019-04-01 16:23:24 -04:00
|
|
|
}
|
2017-06-16 11:44:51 -04:00
|
|
|
|
2019-10-04 09:12:53 -04:00
|
|
|
configurations {
|
|
|
|
restSpec
|
|
|
|
}
|
2017-06-16 11:44:51 -04:00
|
|
|
|
2019-10-04 09:12:53 -04:00
|
|
|
dependencies {
|
|
|
|
restSpec project(':rest-api-spec')
|
|
|
|
}
|
2017-06-16 11:44:51 -04:00
|
|
|
|
2019-10-04 09:12:53 -04:00
|
|
|
processTestResources {
|
|
|
|
dependsOn configurations.restSpec
|
|
|
|
from ({ zipTree(configurations.restSpec.singleFile) }) {
|
|
|
|
include 'rest-api-spec/api/**'
|
|
|
|
}
|
|
|
|
from (project(xpackModule('core')).sourceSets.test.resources) {
|
|
|
|
include 'rest-api-spec/api/**'
|
|
|
|
}
|
|
|
|
}
|
2019-04-01 16:23:24 -04:00
|
|
|
|
2019-10-04 09:12:53 -04:00
|
|
|
for (Version bwcVersion : bwcVersions.indexCompatible) {
|
|
|
|
String baseName = "v${bwcVersion}"
|
|
|
|
|
|
|
|
testClusters {
|
|
|
|
"${baseName}" {
|
|
|
|
testDistribution = "DEFAULT"
|
|
|
|
versions = [bwcVersion.toString(), project.version]
|
|
|
|
numberOfNodes = 2
|
|
|
|
setting 'path.repo', "${buildDir}/cluster/shared/repo/${baseName}"
|
|
|
|
javaHome = project.file(project.ext.runtimeJavaHome)
|
|
|
|
user username: "test_user", password: "x-pack-test-password"
|
|
|
|
|
|
|
|
setting 'path.repo', "${buildDir}/cluster/shared/repo/${baseName}"
|
|
|
|
// some tests rely on the translog not being flushed
|
|
|
|
setting 'indices.memory.shard_inactive_time', '20m'
|
|
|
|
setting 'xpack.security.enabled', 'true'
|
|
|
|
setting 'xpack.security.transport.ssl.enabled', 'true'
|
|
|
|
setting 'xpack.license.self_generated.type', 'trial'
|
|
|
|
|
|
|
|
extraConfigFile 'testnode.pem', file("${outputDir}/testnode.pem")
|
|
|
|
extraConfigFile 'testnode.crt', file("${outputDir}/testnode.crt")
|
|
|
|
|
|
|
|
keystore 'xpack.watcher.encryption_key', file("${project.projectDir}/src/test/resources/system_key")
|
|
|
|
setting 'xpack.watcher.encrypt_sensitive_data', 'true'
|
|
|
|
|
|
|
|
setting 'xpack.security.transport.ssl.key', 'testnode.pem'
|
|
|
|
setting 'xpack.security.transport.ssl.certificate', 'testnode.crt'
|
|
|
|
keystore 'xpack.security.transport.ssl.secure_key_passphrase', 'testnode'
|
2017-06-16 11:44:51 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-04 09:12:53 -04:00
|
|
|
tasks.register("${baseName}#oldClusterTest", RestTestRunnerTask) {
|
|
|
|
mustRunAfter(precommit)
|
|
|
|
useCluster testClusters."${baseName}"
|
|
|
|
dependsOn copyTestNodeKeyMaterial
|
|
|
|
doFirst {
|
|
|
|
project.delete("${buildDir}/cluster/shared/repo/${baseName}")
|
|
|
|
}
|
2019-04-01 16:23:24 -04:00
|
|
|
systemProperty 'tests.is_old_cluster', 'true'
|
|
|
|
systemProperty 'tests.old_cluster_version', version.toString().minus("-SNAPSHOT")
|
|
|
|
exclude 'org/elasticsearch/upgrades/FullClusterRestartIT.class'
|
|
|
|
exclude 'org/elasticsearch/upgrades/FullClusterRestartSettingsUpgradeIT.class'
|
|
|
|
exclude 'org/elasticsearch/upgrades/QueryBuilderBWCIT.class'
|
2017-06-16 11:44:51 -04:00
|
|
|
}
|
|
|
|
|
2019-08-27 06:00:33 -04:00
|
|
|
|
2019-10-04 09:12:53 -04:00
|
|
|
tasks.register("${baseName}#upgradedClusterTest", RestTestRunnerTask) {
|
|
|
|
mustRunAfter(precommit)
|
|
|
|
useCluster testClusters."${baseName}"
|
|
|
|
dependsOn "${baseName}#oldClusterTest"
|
|
|
|
doFirst {
|
|
|
|
testClusters."${baseName}".goToNextVersion()
|
|
|
|
}
|
2019-04-01 16:23:24 -04:00
|
|
|
systemProperty 'tests.is_old_cluster', 'false'
|
|
|
|
systemProperty 'tests.old_cluster_version', version.toString().minus("-SNAPSHOT")
|
|
|
|
exclude 'org/elasticsearch/upgrades/FullClusterRestartIT.class'
|
|
|
|
exclude 'org/elasticsearch/upgrades/FullClusterRestartSettingsUpgradeIT.class'
|
|
|
|
exclude 'org/elasticsearch/upgrades/QueryBuilderBWCIT.class'
|
2017-06-16 11:44:51 -04:00
|
|
|
}
|
|
|
|
|
2019-10-04 09:12:53 -04:00
|
|
|
tasks.matching { it.name.startsWith(baseName) && it.name.endsWith("ClusterTest") }.configureEach {
|
|
|
|
it.systemProperty 'tests.old_cluster_version', bwcVersion.toString().minus("-SNAPSHOT")
|
|
|
|
it.systemProperty 'tests.path.repo', "${buildDir}/cluster/shared/repo/${baseName}"
|
|
|
|
it.nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",") }")
|
|
|
|
it.nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName() }")
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.register("${baseName}#bwcTest") {
|
|
|
|
dependsOn "${baseName}#upgradedClusterTest"
|
2017-06-16 11:44:51 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (project.bwc_tests_enabled) {
|
2019-10-04 09:12:53 -04:00
|
|
|
bwcTest.dependsOn("${baseName}#bwcTest")
|
2017-06-16 11:44:51 -04:00
|
|
|
}
|
2019-04-01 16:23:24 -04:00
|
|
|
}
|
2017-06-16 11:44:51 -04:00
|
|
|
|
2019-04-01 16:23:24 -04:00
|
|
|
task bwcTestSnapshots {
|
2017-06-16 11:44:51 -04:00
|
|
|
if (project.bwc_tests_enabled) {
|
2019-04-01 16:23:24 -04:00
|
|
|
for (final def version : bwcVersions.unreleasedIndexCompatible) {
|
|
|
|
dependsOn "v${version}#bwcTest"
|
|
|
|
}
|
2017-06-16 11:44:51 -04:00
|
|
|
}
|
2019-04-01 16:23:24 -04:00
|
|
|
}
|
2017-06-16 11:44:51 -04:00
|
|
|
|
2019-04-01 16:23:24 -04:00
|
|
|
check.dependsOn(bwcTestSnapshots)
|
2017-06-16 11:44:51 -04:00
|
|
|
|
2019-10-04 09:12:53 -04:00
|
|
|
test.enabled = false
|