mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-19 04:45:07 -04:00
Static fields dont do well in Gradle with configuration cache enabled. - Use buildParams extension in build scripts - Keep BuildParams.ci for now for easy serverless migration - Tweak testing doc
94 lines
3.6 KiB
Groovy
94 lines
3.6 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
|
|
* License v3.0 only", 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'
|
|
|
|
buildParams.bwcVersions.withWireCompatible { bwcVersion, baseName ->
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
def localCluster = testClusters.register("${baseName}-local") {
|
|
numberOfNodes = 2
|
|
versions = [bwcVersion.toString(), project.version]
|
|
setting 'cluster.remote.node.attr', 'gateway'
|
|
setting 'xpack.security.enabled', 'false'
|
|
requiresFeature 'es.failure_store_feature_flag_enabled', new Version(8, 12, 0)
|
|
}
|
|
def remoteCluster = testClusters.register("${baseName}-remote") {
|
|
numberOfNodes = 3
|
|
versions = [bwcVersion.toString(), project.version]
|
|
firstNode.setting 'node.attr.gateway', 'true'
|
|
lastNode.setting 'node.attr.gateway', 'true'
|
|
setting 'xpack.security.enabled', 'false'
|
|
requiresFeature 'es.failure_store_feature_flag_enabled', new Version(8, 12, 0)
|
|
}
|
|
|
|
|
|
tasks.withType(StandaloneRestIntegTestTask).matching { it.name.startsWith("${baseName}#") }.configureEach {
|
|
useCluster localCluster
|
|
useCluster remoteCluster
|
|
systemProperty 'tests.upgrade_from_version', bwcVersion.toString().replace('-SNAPSHOT', '')
|
|
|
|
doFirst {
|
|
nonInputProperties.systemProperty('tests.rest.cluster', localCluster.map(c -> c.allHttpSocketURI.join(",")))
|
|
nonInputProperties.systemProperty('tests.rest.remote_cluster', remoteCluster.map(c -> c.allHttpSocketURI.join(",")))
|
|
}
|
|
|
|
onlyIf("FIPS mode disabled") { buildParams.inFipsJvm == false }
|
|
}
|
|
|
|
tasks.register("${baseName}#oldClusterTest", StandaloneRestIntegTestTask) {
|
|
dependsOn "processTestResources"
|
|
mustRunAfter("precommit")
|
|
doFirst {
|
|
def cluster = localCluster.get()
|
|
cluster.nodes.forEach { node ->
|
|
node.getAllTransportPortURI()
|
|
}
|
|
cluster.nextNodeToNextVersion()
|
|
}
|
|
}
|
|
|
|
tasks.register("${baseName}#oneThirdUpgraded", StandaloneRestIntegTestTask) {
|
|
dependsOn "${baseName}#oldClusterTest"
|
|
doFirst {
|
|
remoteCluster.get().nextNodeToNextVersion()
|
|
}
|
|
}
|
|
|
|
tasks.register("${baseName}#twoThirdUpgraded", StandaloneRestIntegTestTask) {
|
|
dependsOn "${baseName}#oneThirdUpgraded"
|
|
doFirst {
|
|
remoteCluster.get().nextNodeToNextVersion()
|
|
}
|
|
}
|
|
|
|
tasks.register("${baseName}#fullUpgraded", StandaloneRestIntegTestTask) {
|
|
dependsOn "${baseName}#twoThirdUpgraded"
|
|
doFirst {
|
|
remoteCluster.get().nextNodeToNextVersion()
|
|
}
|
|
}
|
|
|
|
tasks.register(bwcTaskName(bwcVersion)) {
|
|
dependsOn tasks.named("${baseName}#fullUpgraded")
|
|
}
|
|
}
|