OpenSearch/x-pack/qa/mixed-tier-cluster/build.gradle

62 lines
2.3 KiB
Groovy

apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-rest-test'
apply from : "$rootDir/gradle/bwc-test.gradle"
apply plugin: 'elasticsearch.rest-test'
import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.VersionProperties
import org.elasticsearch.gradle.info.BuildParams
import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
dependencies {
testImplementation project(':x-pack:qa')
}
// Only run tests for 7.9+, since the node.roles setting was introduced in 7.9.0
for (Version bwcVersion : BuildParams.bwcVersions.wireCompatible.findAll { it.onOrAfter('7.9.0') }) {
if (bwcVersion == VersionProperties.getElasticsearchVersion()) {
// Not really a mixed cluster
continue;
}
String baseName = "v${bwcVersion}"
testClusters {
"${baseName}" {
versions = [bwcVersion.toString(), project.version]
numberOfNodes = 3
testDistribution = 'DEFAULT'
setting 'xpack.security.enabled', 'false'
setting 'xpack.watcher.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
nodes."${baseName}-0".setting 'node.roles', '["master"]'
// data_* roles were introduced in 7.10.0, so use 'data' for older versions
if (bwcVersion.before('7.10.0')) {
nodes."${baseName}-1".setting 'node.roles', '["data"]'
} else {
nodes."${baseName}-1".setting 'node.roles', '["data_content", "data_hot"]'
}
nodes."${baseName}-2".setting 'node.roles', '["master"]'
}
}
tasks.register("${baseName}#mixedClusterTest", StandaloneRestIntegTestTask) {
useCluster testClusters."${baseName}"
mustRunAfter(precommit)
doFirst {
// Getting the endpoints causes a wait for the cluster
println "Endpoints are: ${-> testClusters."${baseName}".allHttpSocketURI.join(",")}"
testClusters."${baseName}".nextNodeToNextVersion()
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",")}")
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName()}")
}
onlyIf { project.bwc_tests_enabled }
}
tasks.register(bwcTaskName(bwcVersion)) {
dependsOn "${baseName}#mixedClusterTest"
}
}