2017-06-16 11:44:51 -04:00
|
|
|
import org.elasticsearch.gradle.Version
|
2019-11-01 14:33:11 -04:00
|
|
|
import org.elasticsearch.gradle.info.BuildParams
|
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-11-14 06:01:23 -05: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)
|
|
|
|
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts')
|
2019-04-15 13:14:43 -04:00
|
|
|
|
2019-11-14 06:01:23 -05:00
|
|
|
testCompile project(path: ':qa:full-cluster-restart', configuration: 'testArtifacts')
|
|
|
|
testCompile project(':x-pack:qa')
|
2017-06-16 11:44:51 -04:00
|
|
|
}
|
|
|
|
|
2017-09-08 15:33:33 -04:00
|
|
|
licenseHeaders {
|
2019-11-14 06:01:23 -05:00
|
|
|
approvedLicenses << 'Apache'
|
2017-09-08 15:33:33 -04:00
|
|
|
}
|
|
|
|
|
2018-12-11 07:15:44 -05:00
|
|
|
forbiddenPatterns {
|
2019-11-14 06:01:23 -05:00
|
|
|
exclude '**/system_key'
|
2018-12-11 07:15:44 -05:00
|
|
|
}
|
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") {
|
2019-11-14 06:01:23 -05: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) {
|
2019-11-14 06:01:23 -05:00
|
|
|
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'
|
|
|
|
)
|
|
|
|
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 {
|
2019-11-14 06:01:23 -05:00
|
|
|
restSpec
|
2019-10-04 09:12:53 -04:00
|
|
|
}
|
2017-06-16 11:44:51 -04:00
|
|
|
|
2019-10-04 09:12:53 -04:00
|
|
|
dependencies {
|
2019-11-14 06:01:23 -05:00
|
|
|
restSpec project(':rest-api-spec')
|
2019-10-04 09:12:53 -04:00
|
|
|
}
|
2017-06-16 11:44:51 -04:00
|
|
|
|
2019-10-04 09:12:53 -04:00
|
|
|
processTestResources {
|
2019-11-14 06:01:23 -05:00
|
|
|
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-10-04 09:12:53 -04:00
|
|
|
}
|
2019-04-01 16:23:24 -04:00
|
|
|
|
2019-10-04 09:12:53 -04:00
|
|
|
for (Version bwcVersion : bwcVersions.indexCompatible) {
|
2019-11-14 06:01:23 -05:00
|
|
|
String baseName = "v${bwcVersion}"
|
|
|
|
|
|
|
|
testClusters {
|
|
|
|
"${baseName}" {
|
|
|
|
testDistribution = "DEFAULT"
|
|
|
|
versions = [bwcVersion.toString(), project.version]
|
|
|
|
numberOfNodes = 2
|
|
|
|
setting 'path.repo', "${buildDir}/cluster/shared/repo/${baseName}"
|
|
|
|
javaHome = BuildParams.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-11-14 06:01:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
tasks.register("${baseName}#oldClusterTest", RestTestRunnerTask) {
|
|
|
|
mustRunAfter(precommit)
|
|
|
|
useCluster testClusters."${baseName}"
|
|
|
|
dependsOn copyTestNodeKeyMaterial
|
|
|
|
doFirst {
|
|
|
|
project.delete("${buildDir}/cluster/shared/repo/${baseName}")
|
2017-06-16 11:44:51 -04:00
|
|
|
}
|
2019-11-14 06:01:23 -05: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'
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
tasks.register("${baseName}#upgradedClusterTest", RestTestRunnerTask) {
|
|
|
|
mustRunAfter(precommit)
|
|
|
|
useCluster testClusters."${baseName}"
|
|
|
|
dependsOn "${baseName}#oldClusterTest"
|
|
|
|
doFirst {
|
|
|
|
testClusters."${baseName}".goToNextVersion()
|
2017-06-16 11:44:51 -04:00
|
|
|
}
|
2019-11-14 06:01:23 -05: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'
|
|
|
|
}
|
|
|
|
|
|
|
|
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"
|
|
|
|
}
|
|
|
|
|
|
|
|
if (project.bwc_tests_enabled) {
|
|
|
|
bwcTest.dependsOn("${baseName}#bwcTest")
|
|
|
|
}
|
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 {
|
2019-11-14 06:01:23 -05:00
|
|
|
if (project.bwc_tests_enabled) {
|
|
|
|
for (final def version : bwcVersions.unreleasedIndexCompatible) {
|
|
|
|
dependsOn "v${version}#bwcTest"
|
2017-06-16 11:44:51 -04:00
|
|
|
}
|
2019-11-14 06:01:23 -05: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
|