OpenSearch/x-pack/qa/rolling-upgrade/build.gradle

228 lines
10 KiB
Groovy
Raw Normal View History

import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-test'
dependencies {
testCompile project(':x-pack:qa')
testCompile project(':client:rest-high-level')
}
compileTestJava.options.compilerArgs << "-Xlint:-cast,-rawtypes,-unchecked"
forbiddenPatterns {
exclude '**/system_key'
}
String outputDir = "${buildDir}/generated-resources/${project.name}"
tasks.register("bwcTest") {
description = 'Runs backwards compatibility tests.'
group = 'verification'
}
configurations {
restSpec
}
dependencies {
restSpec project(':rest-api-spec')
}
processTestResources {
dependsOn configurations.restSpec
from ({ zipTree(configurations.restSpec.singleFile) }) {
include 'rest-api-spec/api/**'
}
from (project(xpackProject('plugin').path).sourceSets.test.resources) {
include 'rest-api-spec/api/**'
}
}
task copyTestNodeKeyMaterial(type: Copy) {
from project(':x-pack:plugin:core').files('src/test/resources/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.pem',
'src/test/resources/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.crt')
into outputDir
}
for (Version bwcVersion : bwcVersions.wireCompatible) {
String baseName = "v${bwcVersion}"
testClusters {
"${baseName}" {
testDistribution = "DEFAULT"
versions = [ bwcVersion.toString(), project.version ]
numberOfNodes = 3
setting 'repositories.url.allowed_urls', 'http://snapshot.test*'
setting 'path.repo', "${buildDir}/cluster/shared/repo/${baseName}"
setting 'http.content_type.required', 'true'
setting 'xpack.license.self_generated.type', 'trial'
setting 'xpack.security.enabled', 'true'
setting 'xpack.security.transport.ssl.enabled', 'true'
setting 'xpack.security.authc.token.enabled', 'true'
setting 'xpack.security.authc.token.timeout', '60m'
setting 'xpack.security.audit.enabled', 'true'
setting 'xpack.security.transport.ssl.key', 'testnode.pem'
setting 'xpack.security.transport.ssl.certificate', 'testnode.crt'
keystore 'xpack.security.transport.ssl.secure_key_passphrase', 'testnode'
if (bwcVersion.onOrAfter('7.0.0')) {
setting 'xpack.security.authc.realms.file.file1.order', '0'
setting 'xpack.security.authc.realms.native.native1.order', '1'
} else {
setting 'xpack.security.authc.realms.file1.type', 'file'
setting 'xpack.security.authc.realms.file1.order', '0'
setting 'xpack.security.authc.realms.native1.type', 'native'
setting 'xpack.security.authc.realms.native1.order', '1'
}
if (bwcVersion.onOrAfter('6.6.0')) {
setting 'ccr.auto_follow.wait_for_metadata_timeout', '1s'
}
user username: "test_user", password: "x-pack-test-password"
extraConfigFile 'testnode.pem', file("$outputDir/testnode.pem")
extraConfigFile 'testnode.crt', file("$outputDir/testnode.crt")
keystore 'xpack.watcher.encryption_key', file("${project.projectDir}/src/test/resources/system_key")
setting 'xpack.watcher.encrypt_sensitive_data', 'true'
// Old versions of the code contain an invalid assertion that trips
// during tests. Versions 5.6.9 and 6.2.4 have been fixed by removing
// the assertion, but this is impossible for released versions.
// However, released versions run without assertions, so end users won't
// be suffering the effects. This argument effectively removes the
// incorrect assertion from the older versions used in the BWC tests.
if (bwcVersion.before('5.6.9') || (bwcVersion.onOrAfter('6.0.0') && bwcVersion.before('6.2.4'))) {
jvmArgs '-da:org.elasticsearch.xpack.monitoring.exporter.http.HttpExportBulk'
}
javaHome = project.file(project.ext.runtimeJavaHome)
}
}
tasks.register("${baseName}#oldClusterTest", RestTestRunnerTask) {
useCluster testClusters."${baseName}"
mustRunAfter(precommit)
dependsOn copyTestNodeKeyMaterial
systemProperty 'tests.rest.suite', 'old_cluster'
systemProperty 'tests.upgrade_from_version', bwcVersion.toString().replace('-SNAPSHOT', '')
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",") }")
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName() }")
def toBlackList = []
// Dataframe transforms were not added until 7.2.0
if (bwcVersion.before('7.2.0')) {
toBlackList << 'old_cluster/80_data_frame_jobs_crud/Test put batch data frame transforms on old cluster'
}
// continuous Dataframe transforms were not added until 7.3.0
if (bwcVersion.before('7.3.0')) {
toBlackList << 'old_cluster/80_data_frame_jobs_crud/Test put continuous data frame transform on old cluster'
}
if (!toBlackList.empty) {
systemProperty 'tests.rest.blacklist', toBlackList.join(',')
}
}
tasks.register("${baseName}#oneThirdUpgradedTest", RestTestRunnerTask) {
dependsOn "${baseName}#oldClusterTest"
useCluster testClusters."${baseName}"
doFirst {
testClusters."${baseName}".nextNodeToNextVersion()
}
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",") }")
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName() }")
systemProperty 'tests.rest.suite', 'mixed_cluster'
systemProperty 'tests.first_round', 'true'
systemProperty 'tests.upgrade_from_version', bwcVersion.toString().replace('-SNAPSHOT', '')
// We only need to run these tests once so we may as well do it when we're two thirds upgraded
def toBlackList = [
'mixed_cluster/10_basic/Start scroll in mixed cluster on upgraded node that we will continue after upgrade',
'mixed_cluster/30_ml_jobs_crud/Create a job in the mixed cluster and write some data',
'mixed_cluster/40_ml_datafeed_crud/Put job and datafeed without aggs in mixed cluster',
'mixed_cluster/40_ml_datafeed_crud/Put job and datafeed with aggs in mixed cluster',
'mixed_cluster/80_data_frame_jobs_crud/Test put batch data frame transforms on mixed cluster',
'mixed_cluster/80_data_frame_jobs_crud/Test put continuous data frame transform on mixed cluster'
]
// Dataframe transforms were not added until 7.2.0
if (bwcVersion.before('7.2.0')) {
toBlackList << 'mixed_cluster/80_data_frame_jobs_crud/Test GET, start, and stop old cluster batch transforms'
}
// continuous Dataframe transforms were not added until 7.3.0
if (bwcVersion.before('7.3.0')) {
toBlackList << 'mixed_cluster/80_data_frame_jobs_crud/Test GET, stop, start, old continuous transforms'
}
systemProperty 'tests.rest.blacklist', toBlackList.join(',')
}
tasks.register("${baseName}#twoThirdsUpgradedTest", RestTestRunnerTask) {
dependsOn "${baseName}#oneThirdUpgradedTest"
useCluster testClusters."${baseName}"
doFirst {
testClusters."${baseName}".nextNodeToNextVersion()
}
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",") }")
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName() }")
systemProperty 'tests.rest.suite', 'mixed_cluster'
systemProperty 'tests.first_round', 'false'
def toBlackList = []
if (bwcVersion.before('7.2.0')) {
toBlackList.addAll([
'mixed_cluster/80_data_frame_jobs_crud/Test put batch data frame transforms on mixed cluster',
'mixed_cluster/80_data_frame_jobs_crud/Test GET, start, and stop old cluster batch transforms',
'mixed_cluster/80_data_frame_jobs_crud/Test put continuous data frame transform on mixed cluster'
])
}
if (bwcVersion.before('7.3.0')) {
toBlackList << 'mixed_cluster/80_data_frame_jobs_crud/Test GET, stop, start, old continuous transforms'
}
if (!toBlackList.empty) {
systemProperty 'tests.rest.blacklist', toBlackList.join(',')
}
systemProperty 'tests.upgrade_from_version', bwcVersion.toString().replace('-SNAPSHOT', '')
}
tasks.register("${baseName}#upgradedClusterTest", RestTestRunnerTask) {
dependsOn "${baseName}#twoThirdsUpgradedTest"
useCluster testClusters."${baseName}"
doFirst {
testClusters."${baseName}".nextNodeToNextVersion()
}
QA: Switch xpack rolling upgrades to three nodes (#31112) This is much more realistic and can find more issues. This causes the "mixed cluster" tests to be run twice so I had to fix the tests to work in that case. In most cases I did as little as possible to get them working but in a few cases I went a little beyond that to make them easier for me to debug while getting them to work. My test changes: 1. Remove the "basic indexing" tests and replace them with a copy of the tests used in the OSS. We have no way of sharing code between these two projects so for now I copy. 2. Skip the a few tests in the "one third" upgraded scenario: * creating a scroll to be reused when the cluster is fully upgraded * creating some ml data to be used when the cluster is fully ugpraded 3. Drop many "assert yellow and that the cluster has two nodes" assertions. These assertions duplicate those made by the wait condition and they fail now that we have three nodes. 4. Switch many "assert green and that the cluster has two nodes" to 3 nodes. These assertions are unique from the wait condition and, while I imagine they aren't required in all cases, now is not the time to find that out. Thus, I made them work. 5. Rework the index audit trail test so it is more obvious that it is the same test expecting different numbers based on the shape of the cluster. The conditions for which number are expected are fairly complex because the index audit trail is shut down until the template for it is upgraded and the template is upgraded when a master node is elected that has the new version of the software. 6. Add some more information to debug the index audit trail test because it helped me figure out what was going on. I also dropped the `waitCondition` from the `rolling-upgrade-basic` tests because it wasn't needed. Closes #25336
2018-06-06 11:59:16 -04:00
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",") }")
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName() }")
systemProperty 'tests.rest.suite', 'upgraded_cluster'
systemProperty 'tests.upgrade_from_version', bwcVersion.toString().replace('-SNAPSHOT', '')
def toBlackList = []
// Dataframe transforms were not added until 7.2.0
if (bwcVersion.before('7.2.0')) {
toBlackList << 'upgraded_cluster/80_data_frame_jobs_crud/Get start, stop, and delete old and mixed cluster batch data frame transforms'
toBlackList << 'upgraded_cluster/80_data_frame_jobs_crud/Test GET, stop, delete, old and mixed continuous transforms'
}
if (!toBlackList.empty) {
systemProperty 'tests.rest.blacklist', toBlackList.join(',')
}
}
tasks.register("${baseName}#bwcTest") {
dependsOn "${baseName}#upgradedClusterTest"
}
if (project.bwc_tests_enabled) {
bwcTest.dependsOn("${baseName}#bwcTest")
}
}
task bwcTestSnapshots {
if (project.bwc_tests_enabled) {
for (final def version : bwcVersions.unreleasedWireCompatible) {
dependsOn "v${version}#bwcTest"
}
}
}
check.dependsOn(bwcTestSnapshots)
test.enabled = false