OpenSearch/x-pack/qa/full-cluster-restart/build.gradle

108 lines
4.3 KiB
Groovy

import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.info.BuildParams
import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
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 MlConfigIndexMappingsFullClusterRestartIT and SLM classes used in
// FullClusterRestartIT
testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts')
testImplementation project(path: ':qa:full-cluster-restart', configuration: 'testArtifacts')
testImplementation project(':x-pack:qa')
}
tasks.named("licenseHeaders").configure {
approvedLicenses << 'Apache'
}
tasks.named("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", StandaloneRestIntegTestTask) {
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", StandaloneRestIntegTestTask) {
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"
}
}