elasticsearch/qa/mixed-cluster/build.gradle

97 lines
4.5 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.VersionProperties
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 {
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.
excludeList.add('cluster.desired_nodes/10_basic/Test settings are validated')
excludeList.add('cluster.desired_nodes/10_basic/Test unknown settings are forbidden in known versions')
excludeList.add('cluster.desired_nodes/10_basic/Test unknown settings are allowed in future versions')
excludeList.add('cluster.desired_nodes/10_basic/Test some settings can be overridden')
excludeList.add('cluster.desired_nodes/20_dry_run/Test validation works for dry run updates')
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'
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"
}
}
}