OpenSearch/x-pack/qa/rolling-upgrade-multi-cluster/build.gradle

137 lines
4.6 KiB
Groovy
Raw Normal View History

2019-02-14 02:12:14 -05:00
import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.info.BuildParams
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask
2019-02-14 02:12:14 -05:00
apply plugin: 'elasticsearch.testclusters'
2019-02-14 02:12:14 -05:00
apply plugin: 'elasticsearch.standalone-test'
dependencies {
testCompile project(':x-pack:qa')
2019-02-14 02:12:14 -05:00
}
tasks.register("bwcTest") {
description = 'Runs backwards compatibility tests.'
group = 'verification'
2019-02-14 02:12:14 -05:00
}
configurations {
restSpec
}
2019-02-14 02:12:14 -05:00
dependencies {
restSpec project(':rest-api-spec')
}
2019-02-14 02:12:14 -05:00
processTestResources {
dependsOn configurations.restSpec
from({ zipTree(configurations.restSpec.singleFile) }) {
include 'rest-api-spec/api/**'
}
from(project(xpackProject('plugin').path).sourceSets.test.resources) {
include 'rest-api-spec/api/**'
}
}
2019-02-14 02:12:14 -05:00
for (Version bwcVersion : bwcVersions.wireCompatible) {
String baseName = "v${bwcVersion}"
testClusters {
"${baseName}-leader" {
numberOfNodes = 3
2019-02-14 02:12:14 -05:00
}
"${baseName}-follower" {
numberOfNodes = 3
2019-02-14 02:12:14 -05:00
}
}
testClusters.matching { it.name.startsWith(baseName) }.all {
testDistribution = "DEFAULT"
versions = [bwcVersion.toString(), project.version]
setting 'repositories.url.allowed_urls', 'http://snapshot.test*'
setting 'xpack.security.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.watcher.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
javaHome = BuildParams.runtimeJavaHome
}
tasks.withType(RestTestRunnerTask).matching { it.name.startsWith(baseName) }.configureEach {
useCluster testClusters."${baseName}-leader"
useCluster testClusters."${baseName}-follower"
systemProperty 'tests.upgrade_from_version', bwcVersion.toString().replace('-SNAPSHOT', '')
doFirst {
if (name.endsWith("#clusterTest") == false) {
println "Upgrade node $it"
testClusters."${baseName}-${kindExt}".nextNodeToNextVersion()
}
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}-${kindExt}".allHttpSocketURI.join(",")}")
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}-${kindExt}".getName()}")
nonInputProperties.systemProperty('tests.leader_host', "${-> testClusters."${baseName}-leader".allHttpSocketURI.last()}")
nonInputProperties.systemProperty('tests.leader_remote_cluster_seed', "${-> testClusters."${baseName}-leader".allTransportPortURI.last()}")
nonInputProperties.systemProperty('tests.follower_host', "${-> testClusters."${baseName}-follower".allHttpSocketURI.last()}")
nonInputProperties.systemProperty('tests.follower_remote_cluster_seed', "${-> testClusters."${baseName}-follower".allTransportPortURI.last()}")
2019-02-14 02:12:14 -05:00
}
}
2019-02-14 02:12:14 -05:00
for (kind in ["follower", "leader"]) {
// Attention!! Groovy trap: do not pass `kind` to a closure
2019-02-14 02:12:14 -05:00
tasks.register("${baseName}#${kind}#clusterTest", RestTestRunnerTask) {
systemProperty 'tests.rest.upgrade_state', 'none'
systemProperty 'tests.rest.cluster_name', kind
ext.kindExt = kind
2019-02-14 02:12:14 -05:00
}
tasks.register("${baseName}#${kind}#oneThirdUpgradedTest", RestTestRunnerTask) {
systemProperty 'tests.rest.upgrade_state', 'one_third'
systemProperty 'tests.rest.cluster_name', kind
dependsOn "${baseName}#leader#clusterTest", "${baseName}#follower#clusterTest"
ext.kindExt = kind
2019-02-14 02:12:14 -05:00
}
tasks.register("${baseName}#${kind}#twoThirdsUpgradedTest", RestTestRunnerTask) {
systemProperty 'tests.rest.upgrade_state', 'two_third'
systemProperty 'tests.rest.cluster_name', kind
dependsOn "${baseName}#${kind}#oneThirdUpgradedTest"
ext.kindExt = kind
2019-02-14 02:12:14 -05:00
}
tasks.register("${baseName}#${kind}#upgradedClusterTest", RestTestRunnerTask) {
systemProperty 'tests.rest.upgrade_state', 'all'
systemProperty 'tests.rest.cluster_name', kind
dependsOn "${baseName}#${kind}#twoThirdsUpgradedTest"
ext.kindExt = kind
2019-02-14 02:12:14 -05:00
}
}
tasks.named("${baseName}#follower#clusterTest") {
dependsOn "${baseName}#leader#clusterTest"
}
tasks.named("${baseName}#leader#oneThirdUpgradedTest") {
dependsOn "${baseName}#follower#upgradedClusterTest"
}
tasks.register("${baseName}#bwcTest") {
dependsOn "${baseName}#leader#upgradedClusterTest"
}
if (project.bwc_tests_enabled) {
bwcTest.dependsOn("${baseName}#bwcTest")
}
2019-02-14 02:12:14 -05:00
}
task bwcTestSnapshots {
if (project.bwc_tests_enabled) {
for (final def version : bwcVersions.unreleasedWireCompatible) {
dependsOn "v${version}#bwcTest"
2019-02-14 02:12:14 -05:00
}
}
2019-02-14 02:12:14 -05:00
}
check.dependsOn(bwcTestSnapshots)
test.enabled = false