elasticsearch/qa/mixed-cluster/build.gradle
Rene Groeschke 13c8aaeffa
[Gradle] Remove static use of BuildParams (#115122)
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
2024-11-15 17:58:57 +01:00

113 lines
5.7 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.VersionProperties
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 {
restTestConfig project(path: ':modules:aggregations', configuration: 'restTests')
}
restResources {
restTests {
includeCore '*'
}
}
def excludeList = []
// Excluding these cache aggregation tests from mixed cluster qa,
// because we can't hit the same node reliable. The qa cluster
// consists of 4 nodes. Two nodes are on old version and the
// other two nodes on the current version. The node selector skips
// the nodes on current version. The rest client then round robins
// between the two nodes on old version. In order to unmute this,
// we need a different node selector, that always consistently
// selects the same node.
excludeList.add('aggregations/adjacency_matrix/Terms lookup')
excludeList.add('aggregations/filter/Standard queries get cached')
excludeList.add('aggregations/filter/Terms lookup gets cached')
excludeList.add('aggregations/filters_bucket/cache hits')
// These tests check setting validations in the desired_node API.
// Validation (and associated tests) are supposed to be skipped/have
// different behaviour for versions before and after 8.10 but mixed
// cluster tests may not respect that - see the comment above.
// Same for node version, which has been deprecated (and made optional)
// starting from 8.13
excludeList.add('cluster.desired_nodes/11_old_format/Test settings are validated')
excludeList.add('cluster.desired_nodes/11_old_format/Test unknown settings are forbidden in known versions')
excludeList.add('cluster.desired_nodes/11_old_format/Test unknown settings are allowed in future versions')
excludeList.add('cluster.desired_nodes/11_old_format/Test some settings can be overridden')
excludeList.add('cluster.desired_nodes/11_old_format/Test node version must be at least the current master version')
excludeList.add('cluster.desired_nodes/11_old_format/Test node version is required')
excludeList.add('cluster.desired_nodes/11_old_format/Test node version must have content')
excludeList.add('cluster.desired_nodes/11_old_format/Test node version can not be null')
excludeList.add('cluster.desired_nodes/20_dry_run/Test validation works for dry run updates')
// Excluded because they create dot-prefixed indices on older versions
excludeList.add('indices.resolve_index/20_resolve_system_index/*')
// Excluded because the error has changed
excludeList.add('aggregations/percentiles_hdr_metric/Negative values test')
buildParams.bwcVersions.withWireCompatible { bwcVersion, baseName ->
if (bwcVersion != VersionProperties.getElasticsearchVersion()) {
/* This project runs the core REST tests against a 4 node cluster where two of
the nodes has a different minor. */
def baseCluster = testClusters.register(baseName) {
versions = [bwcVersion.toString(), project.version]
numberOfNodes = 4
setting 'path.repo', "${buildDir}/cluster/shared/repo/${baseName}"
setting 'xpack.security.enabled', 'false'
setting "xpack.license.self_generated.type", "trial"
/* There is a chance we have more master changes than "normal", so to avoid this test from failing,
we increase the threshold (as this purpose of this test isn't to test that specific indicator). */
if (bwcVersion.onOrAfter(Version.fromString("8.4.0"))) {
setting 'health.master_history.no_master_transitions_threshold', '10'
}
requiresFeature 'es.index_mode_feature_flag_registered', Version.fromString("8.0.0")
}
tasks.register("${baseName}#mixedClusterTest", StandaloneRestIntegTestTask) {
useCluster baseCluster
mustRunAfter("precommit")
doFirst {
delete("${buildDir}/cluster/shared/repo/${baseName}")
// Getting the endpoints causes a wait for the cluster
println "Test cluster endpoints are: ${-> baseCluster.get().allHttpSocketURI.join(",")}"
println "Upgrading one node to create a mixed cluster"
baseCluster.get().nextNodeToNextVersion()
// Getting the endpoints causes a wait for the cluster
println "Upgrade complete, endpoints are: ${-> baseCluster.get().allHttpSocketURI.join(",")}"
println "Upgrading another node to create a mixed cluster"
baseCluster.get().nextNodeToNextVersion()
nonInputProperties.systemProperty('tests.rest.cluster', baseCluster.map(c -> c.allHttpSocketURI.join(",")))
nonInputProperties.systemProperty('tests.clustername', baseName)
if (excludeList.isEmpty() == false) {
systemProperty 'tests.rest.blacklist', excludeList.join(',')
}
}
systemProperty 'tests.path.repo', "${buildDir}/cluster/shared/repo/${baseName}"
systemProperty 'tests.bwc_nodes_version', bwcVersion.toString().replace('-SNAPSHOT', '')
systemProperty 'tests.new_nodes_version', project.version.toString().replace('-SNAPSHOT', '')
onlyIf("BWC tests disabled") { project.bwc_tests_enabled }
}
tasks.register(bwcTaskName(bwcVersion)) {
dependsOn "${baseName}#mixedClusterTest"
}
}
}