elasticsearch/qa/mixed-cluster/build.gradle

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

134 lines
6.7 KiB
Groovy
Raw Normal View History

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
2024-09-14 04:28:03 +08:00
* 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
import org.elasticsearch.gradle.testclusters.TestClusterValueSource
import org.elasticsearch.gradle.testclusters.TestClustersRegistry
import org.elasticsearch.gradle.util.GradleUtils
import org.elasticsearch.gradle.testclusters.TestClustersPlugin
apply plugin: 'elasticsearch.internal-testclusters'
apply plugin: 'elasticsearch.standalone-rest-test'
apply plugin: 'elasticsearch.bwc-test'
Create plugin for yamlTest task (#56841) This commit creates a new Gradle plugin to provide a separate task name and source set for running YAML based REST tests. The only project converted to use the new plugin in this PR is distribution/archives/integ-test-zip. For which the testing has been moved to :rest-api-spec since it makes the most sense and it avoids a small but awkward change to the distribution plugin. The remaining cases in modules, plugins, and x-pack will be handled in followups. This plugin is distinctly different from the plugin introduced in #55896 since the YAML REST tests are intended to be black box tests over HTTP. As such they should not (by default) have access to the classpath for that which they are testing. The YAML based REST tests will be moved to separate source sets (yamlRestTest). The which source is the target for the test resources is dependent on if this new plugin is applied. If it is not applied, it will default to the test source set. Further, this introduces a breaking change for plugin developers that use the YAML testing framework. They will now need to either use the new source set and matching task, or configure the rest resources to use the old "test" source set that matches the old integTest task. (The former should be preferred). As part of this change (which is also breaking for plugin developers) the rest resources plugin has been removed from the build plugin and now requires either explicit application or application via the new YAML REST test plugin. Plugin developers should be able to fix the breaking changes to the YAML tests by adding apply plugin: 'elasticsearch.yaml-rest-test' and moving the YAML tests under a yamlRestTest folder (instead of test)
2020-07-07 01:13:01 +08:00
apply plugin: 'elasticsearch.rest-resources'
dependencies {
restTestConfig project(path: ':modules:aggregations', configuration: 'restTests')
restTestConfig project(path: ':modules:mapper-extras', configuration: 'restTests')
}
Smarter copying of the rest specs and tests (#52114) This PR addresses the unnecessary copying of the rest specs and allows for better semantics for which specs and tests are copied. By default the rest specs will get copied if the project applies `elasticsearch.standalone-rest-test` or `esplugin` and the project has rest tests or you configure the custom extension `restResources`. This PR also removes the need for dozens of places where the x-pack specs were copied by supporting copying of the x-pack rest specs too. The plugin/task introduced here can also copy the rest tests to the local project through a similar configuration. The new plugin/task allows a user to minimize the surface area of which rest specs are copied. Per project can be configured to include only a subset of the specs (or tests). Configuring a project to only copy the specs when actually needed should help with build cache hit rates since we can better define what is actually in use. However, project level optimizations for build cache hit rates are not included with this PR. Also, with this PR you can no longer use the includePackaged flag on integTest task. The following items are included in this PR: * new plugin: `elasticsearch.rest-resources` * new tasks: CopyRestApiTask and CopyRestTestsTask - performs the copy * new extension 'restResources' ``` restResources { restApi { includeCore 'foo' , 'bar' //will include the core specs that start with foo and bar includeXpack 'baz' //will include x-pack specs that start with baz } restTests { includeCore 'foo', 'bar' //will include the core tests that start with foo and bar includeXpack 'baz' //will include the x-pack tests that start with baz } } ```
2020-02-26 08:46:32 +08:00
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')
// sync_id is removed in 9.0
excludeList.add("cat.shards/10_basic/Help")
def clusterPath = getPath()
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', "${layout.buildDirectory.asFile.get()}/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")
if (bwcVersion.before(Version.fromString("8.18.0"))) {
jvmArgs '-da:org.elasticsearch.index.mapper.DocumentMapper'
jvmArgs '-da:org.elasticsearch.index.mapper.MapperService'
}
}
tasks.register("${baseName}#mixedClusterTest", StandaloneRestIntegTestTask) {
useCluster baseCluster
mustRunAfter("precommit")
def baseInfo = getClusterInfo(baseName).map { it.allHttpSocketURI.join(",") }
def baseInfoAfterOneNodeUpdate = getClusterInfo(baseName).map { it.allHttpSocketURI.join(",") }
def baseInfoAfterTwoNodesUpdate = getClusterInfo(baseName).map { it.allHttpSocketURI.join(",") }
def sharedRepoFolder = layout.buildDirectory.file("cluster/shared/repo/${baseName}").get().asFile
doFirst {
delete(sharedRepoFolder)
// Getting the endpoints causes a wait for the cluster
println "Test cluster endpoints are: ${-> baseInfo.get().join(",")}"
println "Upgrading one node to create a mixed cluster"
getRegistry().get().nextNodeToNextVersion(baseCluster)
// Getting the endpoints causes a wait for the cluster
println "Upgrade complete, endpoints are: ${-> baseInfoAfterOneNodeUpdate.get()}"
println "Upgrading another node to create a mixed cluster"
getRegistry().get().nextNodeToNextVersion(baseCluster)
}
if (excludeList.isEmpty() == false) {
systemProperty 'tests.rest.blacklist', excludeList.join(',')
}
nonInputProperties.systemProperty('tests.rest.cluster', baseInfoAfterTwoNodesUpdate)
nonInputProperties.systemProperty('tests.clustername', baseName)
systemProperty 'tests.path.repo', "${layout.buildDirectory.file("cluster/shared/repo/${baseName}").get().asFile}"
systemProperty 'tests.bwc_nodes_version', bwcVersion.toString().replace('-SNAPSHOT', '')
systemProperty 'tests.new_nodes_version', project.version.toString().replace('-SNAPSHOT', '')
def bwcEnabled = project.bwc_tests_enabled
onlyIf("BWC tests disabled") { bwcEnabled }
}
tasks.register(bwcTaskName(bwcVersion)) {
dependsOn "${baseName}#mixedClusterTest"
}
}
}