elasticsearch/qa/ccs-rolling-upgrade-remote-.../build.gradle

87 lines
3.2 KiB
Groovy

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.internal.info.BuildParams
import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
apply plugin: 'elasticsearch.internal-testclusters'
apply plugin: 'elasticsearch.standalone-rest-test'
apply plugin: 'elasticsearch.bwc-test'
apply plugin: 'elasticsearch.rest-resources'
dependencies {
testImplementation project(':client:rest-high-level')
}
for (Version bwcVersion : BuildParams.bwcVersions.wireCompatible) {
String baseName = "v${bwcVersion}"
String bwcVersionStr = "${bwcVersion}"
/**
* We execute tests 3 times.
* - The local cluster is unchanged and it consists of an old version node and a new version node.
* - Nodes in the remote cluster are upgraded one by one in three steps.
* - Only node-0 and node-2 of the remote cluster can accept remote connections. This can creates a test
* scenario where a query request and fetch request are sent via **proxy nodes** that have different version.
*/
testClusters {
"${baseName}-local" {
numberOfNodes = 2
versions = [bwcVersionStr, project.version]
setting 'cluster.remote.node.attr', 'gateway'
setting 'xpack.security.enabled', 'false'
}
"${baseName}-remote" {
numberOfNodes = 3
versions = [bwcVersionStr, project.version]
firstNode.setting 'node.attr.gateway', 'true'
lastNode.setting 'node.attr.gateway', 'true'
setting 'xpack.security.enabled', 'false'
}
}
tasks.withType(StandaloneRestIntegTestTask).matching { it.name.startsWith("${baseName}#") }.configureEach {
useCluster testClusters."${baseName}-local"
useCluster testClusters."${baseName}-remote"
systemProperty 'tests.upgrade_from_version', bwcVersionStr.replace('-SNAPSHOT', '')
doFirst {
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}-local".allHttpSocketURI.join(",")}")
nonInputProperties.systemProperty('tests.rest.remote_cluster', "${-> testClusters."${baseName}-remote".allHttpSocketURI.join(",")}")
}
}
tasks.register("${baseName}#oneThirdUpgraded", StandaloneRestIntegTestTask) {
dependsOn "processTestResources"
mustRunAfter("precommit")
doFirst {
testClusters."${baseName}-local".nextNodeToNextVersion()
testClusters."${baseName}-remote".nextNodeToNextVersion()
}
}
tasks.register("${baseName}#twoThirdUpgraded", StandaloneRestIntegTestTask) {
dependsOn "${baseName}#oneThirdUpgraded"
doFirst {
testClusters."${baseName}-remote".nextNodeToNextVersion()
}
}
tasks.register("${baseName}#fullUpgraded", StandaloneRestIntegTestTask) {
dependsOn "${baseName}#twoThirdUpgraded"
doFirst {
testClusters."${baseName}-remote".nextNodeToNextVersion()
}
}
tasks.register(bwcTaskName(bwcVersion)) {
dependsOn tasks.named("${baseName}#fullUpgraded")
}
}