2017-06-16 11:44:51 -04:00
|
|
|
import org.elasticsearch.gradle.Version
|
2020-05-11 03:39:13 -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'
|
2020-03-03 17:40:55 -05:00
|
|
|
apply from : "$rootDir/gradle/bwc-test.gradle"
|
2019-04-01 16:23:24 -04:00
|
|
|
|
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("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
|
|
|
|
2020-05-11 03:39:13 -04:00
|
|
|
for (Version bwcVersion : BuildParams.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}"
|
|
|
|
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
|
2020-02-07 11:09:40 -05:00
|
|
|
setting 'indices.memory.shard_inactive_time', '60m'
|
2019-11-14 06:01:23 -05:00
|
|
|
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'
|
2020-01-27 08:09:13 -05:00
|
|
|
setting 'logger.org.elasticsearch.xpack.watcher', 'DEBUG'
|
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'
|
|
|
|
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'
|
|
|
|
exclude 'org/elasticsearch/upgrades/FullClusterRestartIT.class'
|
|
|
|
exclude 'org/elasticsearch/upgrades/FullClusterRestartSettingsUpgradeIT.class'
|
|
|
|
exclude 'org/elasticsearch/upgrades/QueryBuilderBWCIT.class'
|
|
|
|
}
|
|
|
|
|
2020-04-08 19:47:02 -04:00
|
|
|
String oldVersion = bwcVersion.toString().minus("-SNAPSHOT")
|
2019-11-14 06:01:23 -05:00
|
|
|
tasks.matching { it.name.startsWith(baseName) && it.name.endsWith("ClusterTest") }.configureEach {
|
2020-04-08 19:47:02 -04:00
|
|
|
it.systemProperty 'tests.old_cluster_version', oldVersion
|
2019-11-14 06:01:23 -05:00
|
|
|
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()}")
|
|
|
|
}
|
|
|
|
|
2020-03-03 17:40:55 -05:00
|
|
|
tasks.register(bwcTaskName(bwcVersion)) {
|
2019-11-14 06:01:23 -05:00
|
|
|
dependsOn "${baseName}#upgradedClusterTest"
|
|
|
|
}
|
2019-04-01 16:23:24 -04:00
|
|
|
}
|