107 lines
4.2 KiB
Groovy
107 lines
4.2 KiB
Groovy
import org.elasticsearch.gradle.Version
|
|
import org.elasticsearch.gradle.info.BuildParams
|
|
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask
|
|
|
|
apply plugin: 'elasticsearch.testclusters'
|
|
apply plugin: 'elasticsearch.standalone-test'
|
|
apply from : "$rootDir/gradle/bwc-test.gradle"
|
|
|
|
dependencies {
|
|
// 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)
|
|
testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts')
|
|
|
|
testImplementation project(path: ':qa:full-cluster-restart', configuration: 'testArtifacts')
|
|
testImplementation project(':x-pack:qa')
|
|
}
|
|
|
|
licenseHeaders {
|
|
approvedLicenses << 'Apache'
|
|
}
|
|
|
|
forbiddenPatterns {
|
|
exclude '**/system_key'
|
|
}
|
|
|
|
String outputDir = "${buildDir}/generated-resources/${project.name}"
|
|
|
|
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'
|
|
)
|
|
into outputDir
|
|
}
|
|
|
|
for (Version bwcVersion : BuildParams.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}"
|
|
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', '60m'
|
|
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'
|
|
setting 'logger.org.elasticsearch.xpack.watcher', 'DEBUG'
|
|
}
|
|
}
|
|
|
|
tasks.register("${baseName}#oldClusterTest", RestTestRunnerTask) {
|
|
mustRunAfter(precommit)
|
|
useCluster testClusters."${baseName}"
|
|
dependsOn copyTestNodeKeyMaterial
|
|
doFirst {
|
|
project.delete("${buildDir}/cluster/shared/repo/${baseName}")
|
|
}
|
|
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()
|
|
}
|
|
systemProperty 'tests.is_old_cluster', 'false'
|
|
exclude 'org/elasticsearch/upgrades/FullClusterRestartIT.class'
|
|
exclude 'org/elasticsearch/upgrades/FullClusterRestartSettingsUpgradeIT.class'
|
|
exclude 'org/elasticsearch/upgrades/QueryBuilderBWCIT.class'
|
|
}
|
|
|
|
String oldVersion = bwcVersion.toString().minus("-SNAPSHOT")
|
|
tasks.matching { it.name.startsWith("${baseName}#") && it.name.endsWith("ClusterTest") }.configureEach {
|
|
it.systemProperty 'tests.old_cluster_version', oldVersion
|
|
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(bwcTaskName(bwcVersion)) {
|
|
dependsOn "${baseName}#upgradedClusterTest"
|
|
}
|
|
}
|