201 lines
9.2 KiB
Groovy
201 lines
9.2 KiB
Groovy
import org.elasticsearch.gradle.Version
|
|
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask
|
|
|
|
apply plugin: 'elasticsearch.testclusters'
|
|
apply plugin: 'elasticsearch.standalone-test'
|
|
apply from : "$rootDir/gradle/bwc-test.gradle"
|
|
|
|
dependencies {
|
|
testCompile project(':x-pack:qa')
|
|
testCompile project(':client:rest-high-level')
|
|
}
|
|
|
|
restResources {
|
|
restApi {
|
|
includeCore '*'
|
|
includeXpack '*'
|
|
}
|
|
}
|
|
|
|
forbiddenPatterns {
|
|
exclude '**/system_key'
|
|
}
|
|
|
|
String outputDir = "${buildDir}/generated-resources/${project.name}"
|
|
|
|
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'
|
|
}
|
|
setting 'logger.org.elasticsearch.xpack.watcher', 'DEBUG'
|
|
}
|
|
}
|
|
|
|
String oldVersion = bwcVersion.toString().replace('-SNAPSHOT', '')
|
|
tasks.register("${baseName}#oldClusterTest", RestTestRunnerTask) {
|
|
useCluster testClusters."${baseName}"
|
|
mustRunAfter(precommit)
|
|
dependsOn copyTestNodeKeyMaterial
|
|
systemProperty 'tests.rest.suite', 'old_cluster'
|
|
systemProperty 'tests.upgrade_from_version', oldVersion
|
|
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 (Version.fromString(oldVersion).before('7.2.0')) {
|
|
toBlackList << 'old_cluster/80_transform_jobs_crud/Test put batch transform on old cluster'
|
|
}
|
|
// continuous Dataframe transforms were not added until 7.3.0
|
|
if (Version.fromString(oldVersion).before('7.3.0')) {
|
|
toBlackList << 'old_cluster/80_transform_jobs_crud/Test put continuous 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', oldVersion
|
|
// 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_transform_jobs_crud/Test put batch transform on mixed cluster',
|
|
'mixed_cluster/80_transform_jobs_crud/Test put continuous transform on mixed cluster',
|
|
]
|
|
// transform in mixed cluster is effectively disabled till 7.4, see gh#48019
|
|
if (Version.fromString(oldVersion).before('7.4.0')) {
|
|
toBlackList.addAll([
|
|
'mixed_cluster/80_transform_jobs_crud/Test GET, start, and stop old cluster batch transforms',
|
|
'mixed_cluster/80_transform_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 = []
|
|
// transform in mixed cluster is effectively disabled till 7.4, see gh#48019
|
|
if (Version.fromString(oldVersion).before('7.4.0')) {
|
|
toBlackList.addAll([
|
|
'mixed_cluster/80_transform_jobs_crud/Test put batch transform on mixed cluster',
|
|
'mixed_cluster/80_transform_jobs_crud/Test GET, start, and stop old cluster batch transforms',
|
|
'mixed_cluster/80_transform_jobs_crud/Test put continuous transform on mixed cluster',
|
|
'mixed_cluster/80_transform_jobs_crud/Test GET, stop, start, old continuous transforms'
|
|
])
|
|
}
|
|
if (!toBlackList.empty) {
|
|
systemProperty 'tests.rest.blacklist', toBlackList.join(',')
|
|
}
|
|
systemProperty 'tests.upgrade_from_version', oldVersion
|
|
}
|
|
|
|
tasks.register("${baseName}#upgradedClusterTest", RestTestRunnerTask) {
|
|
dependsOn "${baseName}#twoThirdsUpgradedTest"
|
|
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', 'upgraded_cluster'
|
|
systemProperty 'tests.upgrade_from_version', oldVersion
|
|
def toBlackList = []
|
|
// Dataframe transforms were not added until 7.2.0
|
|
if (Version.fromString(oldVersion).before('7.2.0')) {
|
|
toBlackList << 'upgraded_cluster/80_transform_jobs_crud/Get start, stop, and delete old cluster batch transform'
|
|
}
|
|
// continuous Dataframe transforms were not added until 7.3.0
|
|
if (Version.fromString(oldVersion).before('7.3.0')) {
|
|
toBlackList << 'upgraded_cluster/80_transform_jobs_crud/Test GET, stop, delete, old continuous transforms'
|
|
}
|
|
// transform in mixed cluster is effectively disabled till 7.4, see gh#48019
|
|
if (Version.fromString(oldVersion).before('7.4.0')) {
|
|
toBlackList << 'upgraded_cluster/80_transform_jobs_crud/Get start, stop mixed cluster batch transform'
|
|
toBlackList << 'upgraded_cluster/80_transform_jobs_crud/Test GET, mixed continuous transforms'
|
|
}
|
|
|
|
if (!toBlackList.empty) {
|
|
systemProperty 'tests.rest.blacklist', toBlackList.join(',')
|
|
}
|
|
}
|
|
|
|
tasks.register(bwcTaskName(bwcVersion)) {
|
|
dependsOn "${baseName}#upgradedClusterTest"
|
|
}
|
|
}
|