2017-05-18 05:25:54 -04:00
|
|
|
import org.elasticsearch.gradle.Version
|
2019-11-01 14:33:11 -04:00
|
|
|
import org.elasticsearch.gradle.info.BuildParams
|
2019-10-04 09:12:53 -04:00
|
|
|
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask
|
2016-11-22 12:00:09 -05:00
|
|
|
|
2019-10-04 09:12:53 -04:00
|
|
|
apply plugin: 'elasticsearch.testclusters'
|
2019-04-01 16:23:24 -04:00
|
|
|
apply plugin: 'elasticsearch.standalone-test'
|
|
|
|
|
2017-06-08 12:55:10 -04:00
|
|
|
dependencies {
|
2019-04-15 13:14:43 -04:00
|
|
|
testCompile project(':x-pack:qa')
|
2019-06-04 16:50:23 -04:00
|
|
|
testCompile project(':client:rest-high-level')
|
2017-06-08 12:55:10 -04:00
|
|
|
}
|
2016-11-22 12:00:09 -05:00
|
|
|
|
2019-04-05 02:01:56 -04:00
|
|
|
compileTestJava.options.compilerArgs << "-Xlint:-cast,-rawtypes,-unchecked"
|
2018-01-17 14:18:44 -05:00
|
|
|
|
2018-12-11 07:15:44 -05:00
|
|
|
forbiddenPatterns {
|
|
|
|
exclude '**/system_key'
|
|
|
|
}
|
|
|
|
|
2019-04-01 16:23:24 -04:00
|
|
|
String outputDir = "${buildDir}/generated-resources/${project.name}"
|
2018-12-11 07:15:44 -05:00
|
|
|
|
2019-10-04 09:12:53 -04:00
|
|
|
tasks.register("bwcTest") {
|
2019-11-14 06:01:23 -05:00
|
|
|
description = 'Runs backwards compatibility tests.'
|
|
|
|
group = 'verification'
|
2019-04-01 16:23:24 -04:00
|
|
|
}
|
2017-06-08 12:55:10 -04:00
|
|
|
|
2019-10-04 09:12:53 -04:00
|
|
|
configurations {
|
2019-11-14 06:01:23 -05:00
|
|
|
restSpec
|
2019-10-04 09:12:53 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2019-11-14 06:01:23 -05:00
|
|
|
restSpec project(':rest-api-spec')
|
2019-10-04 09:12:53 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
processTestResources {
|
2019-11-14 06:01:23 -05:00
|
|
|
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/**'
|
|
|
|
}
|
2019-10-04 09:12:53 -04:00
|
|
|
}
|
|
|
|
|
2019-04-01 16:23:24 -04:00
|
|
|
task copyTestNodeKeyMaterial(type: Copy) {
|
2019-11-14 06:01:23 -05:00
|
|
|
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
|
2019-04-01 16:23:24 -04:00
|
|
|
}
|
2017-05-23 21:42:16 -04:00
|
|
|
|
2019-10-04 09:12:53 -04:00
|
|
|
for (Version bwcVersion : bwcVersions.wireCompatible) {
|
2019-11-14 06:01:23 -05:00
|
|
|
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'
|
|
|
|
}
|
|
|
|
|
2020-01-30 08:01:30 -05:00
|
|
|
setting 'logger.org.elasticsearch.xpack.watcher', 'DEBUG'
|
2019-04-01 16:23:24 -04:00
|
|
|
}
|
2019-11-14 06:01:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
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')) {
|
2019-11-20 12:51:11 -05:00
|
|
|
toBlackList << 'old_cluster/80_transform_jobs_crud/Test put batch transform on old cluster'
|
2019-04-01 16:23:24 -04:00
|
|
|
}
|
2019-11-14 06:01:23 -05:00
|
|
|
// continuous Dataframe transforms were not added until 7.3.0
|
|
|
|
if (bwcVersion.before('7.3.0')) {
|
2019-11-20 12:51:11 -05:00
|
|
|
toBlackList << 'old_cluster/80_transform_jobs_crud/Test put continuous transform on old cluster'
|
2017-05-26 10:02:13 -04:00
|
|
|
}
|
2019-11-14 06:01:23 -05:00
|
|
|
if (!toBlackList.empty) {
|
|
|
|
systemProperty 'tests.rest.blacklist', toBlackList.join(',')
|
2017-05-26 10:02:13 -04:00
|
|
|
}
|
2019-11-14 06:01:23 -05:00
|
|
|
}
|
2017-02-22 03:56:52 -05:00
|
|
|
|
2019-11-14 06:01:23 -05:00
|
|
|
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',
|
2019-11-20 12:51:11 -05:00
|
|
|
'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',
|
2019-11-14 06:01:23 -05:00
|
|
|
]
|
|
|
|
// transform in mixed cluster is effectively disabled till 7.4, see gh#48019
|
|
|
|
if (bwcVersion.before('7.4.0')) {
|
|
|
|
toBlackList.addAll([
|
2019-11-20 12:51:11 -05:00
|
|
|
'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'
|
2019-11-14 06:01:23 -05:00
|
|
|
])
|
|
|
|
}
|
|
|
|
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 (bwcVersion.before('7.4.0')) {
|
|
|
|
toBlackList.addAll([
|
2019-11-20 12:51:11 -05:00
|
|
|
'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'
|
2019-11-14 06:01:23 -05:00
|
|
|
])
|
|
|
|
}
|
|
|
|
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()
|
2017-05-18 14:39:36 -04:00
|
|
|
}
|
2016-11-22 12:00:09 -05:00
|
|
|
|
2019-11-14 06:01:23 -05: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')) {
|
2019-11-20 12:51:11 -05:00
|
|
|
toBlackList << 'upgraded_cluster/80_transform_jobs_crud/Get start, stop, and delete old cluster batch transform'
|
2019-11-14 06:01:23 -05:00
|
|
|
}
|
|
|
|
// continuous Dataframe transforms were not added until 7.3.0
|
|
|
|
if (bwcVersion.before('7.3.0')) {
|
2019-11-20 12:51:11 -05:00
|
|
|
toBlackList << 'upgraded_cluster/80_transform_jobs_crud/Test GET, stop, delete, old continuous transforms'
|
2019-11-14 06:01:23 -05:00
|
|
|
}
|
|
|
|
// transform in mixed cluster is effectively disabled till 7.4, see gh#48019
|
|
|
|
if (bwcVersion.before('7.4.0')) {
|
2019-11-20 12:51:11 -05:00
|
|
|
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'
|
2017-05-26 10:02:13 -04:00
|
|
|
}
|
2017-05-18 05:25:54 -04:00
|
|
|
|
2019-11-14 06:01:23 -05:00
|
|
|
if (!toBlackList.empty) {
|
|
|
|
systemProperty 'tests.rest.blacklist', toBlackList.join(',')
|
2017-06-15 07:45:20 -04:00
|
|
|
}
|
2019-11-14 06:01:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
tasks.register("${baseName}#bwcTest") {
|
|
|
|
dependsOn "${baseName}#upgradedClusterTest"
|
|
|
|
}
|
|
|
|
|
|
|
|
if (project.bwc_tests_enabled) {
|
|
|
|
bwcTest.dependsOn("${baseName}#bwcTest")
|
|
|
|
}
|
2019-04-01 16:23:24 -04:00
|
|
|
}
|
2016-11-22 12:00:09 -05:00
|
|
|
|
2019-04-01 16:23:24 -04:00
|
|
|
task bwcTestSnapshots {
|
2019-11-14 06:01:23 -05:00
|
|
|
if (project.bwc_tests_enabled) {
|
|
|
|
for (final def version : bwcVersions.unreleasedWireCompatible) {
|
|
|
|
dependsOn "v${version}#bwcTest"
|
2017-06-15 07:45:20 -04:00
|
|
|
}
|
2019-11-14 06:01:23 -05:00
|
|
|
}
|
2019-04-01 16:23:24 -04:00
|
|
|
}
|
|
|
|
check.dependsOn(bwcTestSnapshots)
|
2018-01-17 14:18:44 -05:00
|
|
|
|
2019-11-14 06:01:23 -05:00
|
|
|
test.enabled = false
|