2016-11-22 12:00:09 -05:00
|
|
|
import org.elasticsearch.gradle.test.NodeInfo
|
|
|
|
import org.elasticsearch.gradle.test.RestIntegTestTask
|
2017-05-18 05:25:54 -04:00
|
|
|
import org.elasticsearch.gradle.Version
|
2016-11-22 12:00:09 -05:00
|
|
|
|
|
|
|
import java.nio.charset.StandardCharsets
|
2017-06-08 12:55:10 -04:00
|
|
|
|
|
|
|
// Apply the java plugin to this project so the sources can be edited in an IDE
|
2019-04-01 16:23:24 -04:00
|
|
|
apply plugin: 'elasticsearch.standalone-test'
|
|
|
|
|
2019-04-09 14:52:50 -04:00
|
|
|
test.enabled = false
|
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
|
|
|
|
|
|
|
Closure waitWithAuth = { NodeInfo node, AntBuilder ant ->
|
|
|
|
File tmpFile = new File(node.cwd, 'wait.success')
|
2017-06-29 16:27:57 -04:00
|
|
|
|
2017-11-08 12:46:53 -05:00
|
|
|
// wait up to two minutes
|
|
|
|
final long stopTime = System.currentTimeMillis() + (2 * 60000L);
|
2016-11-22 12:00:09 -05:00
|
|
|
Exception lastException = null;
|
2018-02-12 12:45:46 -05:00
|
|
|
int lastResponseCode = 0
|
2017-06-29 16:27:57 -04:00
|
|
|
|
2016-11-22 12:00:09 -05:00
|
|
|
while (System.currentTimeMillis() < stopTime) {
|
2017-06-29 16:27:57 -04:00
|
|
|
|
|
|
|
lastException = null;
|
|
|
|
// we use custom wait logic here as the elastic user is not available immediately and ant.get will fail when a 401 is returned
|
|
|
|
HttpURLConnection httpURLConnection = null;
|
|
|
|
try {
|
|
|
|
// TODO this sucks having to hardcode number of nodes, but node.config.numNodes isn't necessarily accurate for rolling
|
2018-06-06 11:59:16 -04:00
|
|
|
httpURLConnection = (HttpURLConnection) new URL("http://${node.httpUri()}/_cluster/health?wait_for_nodes=3&wait_for_status=yellow").openConnection();
|
2017-06-29 16:27:57 -04:00
|
|
|
httpURLConnection.setRequestProperty("Authorization", "Basic " +
|
2017-07-13 20:59:50 -04:00
|
|
|
Base64.getEncoder().encodeToString("test_user:x-pack-test-password".getBytes(StandardCharsets.UTF_8)));
|
2016-11-22 12:00:09 -05:00
|
|
|
httpURLConnection.setRequestMethod("GET");
|
|
|
|
httpURLConnection.setConnectTimeout(1000);
|
|
|
|
httpURLConnection.setReadTimeout(30000); // read needs to wait for nodes!
|
|
|
|
httpURLConnection.connect();
|
2018-02-12 12:45:46 -05:00
|
|
|
lastResponseCode = httpURLConnection.getResponseCode()
|
|
|
|
if (lastResponseCode == 200) {
|
2016-11-22 12:00:09 -05:00
|
|
|
tmpFile.withWriter StandardCharsets.UTF_8.name(), {
|
|
|
|
it.write(httpURLConnection.getInputStream().getText(StandardCharsets.UTF_8.name()))
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
|
|
logger.debug("failed to call cluster health", e)
|
|
|
|
lastException = e
|
|
|
|
} finally {
|
|
|
|
if (httpURLConnection != null) {
|
|
|
|
httpURLConnection.disconnect();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// did not start, so wait a bit before trying again
|
|
|
|
Thread.sleep(500L);
|
|
|
|
}
|
2018-02-12 12:45:46 -05:00
|
|
|
if (tmpFile.exists() == false) {
|
|
|
|
final String message = "final attempt of calling cluster health failed [lastResponseCode=${lastResponseCode}]"
|
|
|
|
if (lastException != null) {
|
|
|
|
logger.error(message, lastException)
|
|
|
|
} else {
|
|
|
|
logger.error(message + " [no exception]")
|
|
|
|
}
|
2016-11-22 12:00:09 -05:00
|
|
|
}
|
|
|
|
return tmpFile.exists()
|
|
|
|
}
|
|
|
|
|
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-04-01 16:23:24 -04:00
|
|
|
// This is a top level task which we will add dependencies to below.
|
|
|
|
// It is a single task that can be used to backcompat tests against all versions.
|
|
|
|
task bwcTest {
|
2017-06-08 12:55:10 -04: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-04-01 16:23:24 -04:00
|
|
|
task copyTestNodeKeyMaterial(type: Copy) {
|
2019-03-18 02:52:14 -04:00
|
|
|
from project(':x-pack:plugin:core').files('src/test/resources/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.pem',
|
2019-04-01 16:23:24 -04:00
|
|
|
'src/test/resources/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.crt',
|
|
|
|
'src/test/resources/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.jks')
|
2017-05-23 21:42:16 -04:00
|
|
|
into outputDir
|
2019-04-01 16:23:24 -04:00
|
|
|
}
|
2017-05-23 21:42:16 -04:00
|
|
|
|
2019-04-01 16:23:24 -04:00
|
|
|
for (Version version : bwcVersions.wireCompatible) {
|
2017-06-08 12:55:10 -04:00
|
|
|
String baseName = "v${version}"
|
[7.x Backport] Force selection of calendar or fixed intervals (#41906)
The date_histogram accepts an interval which can be either a calendar
interval (DST-aware, leap seconds, arbitrary length of months, etc) or
fixed interval (strict multiples of SI units). Unfortunately this is inferred
by first trying to parse as a calendar interval, then falling back to fixed
if that fails.
This leads to confusing arrangement where `1d` == calendar, but
`2d` == fixed. And if you want a day of fixed time, you have to
specify `24h` (e.g. the next smallest unit). This arrangement is very
error-prone for users.
This PR adds `calendar_interval` and `fixed_interval` parameters to any
code that uses intervals (date_histogram, rollup, composite, datafeed, etc).
Calendar only accepts calendar intervals, fixed accepts any combination of
units (meaning `1d` can be used to specify `24h` in fixed time), and both
are mutually exclusive.
The old interval behavior is deprecated and will throw a deprecation warning.
It is also mutually exclusive with the two new parameters. In the future the
old dual-purpose interval will be removed.
The change applies to both REST and java clients.
2019-05-20 12:07:29 -04:00
|
|
|
|
2017-05-18 05:25:54 -04:00
|
|
|
|
2017-05-26 10:02:13 -04:00
|
|
|
Task oldClusterTest = tasks.create(name: "${baseName}#oldClusterTest", type: RestIntegTestTask) {
|
2019-04-01 16:23:24 -04:00
|
|
|
mustRunAfter(precommit)
|
2017-05-26 10:02:13 -04:00
|
|
|
}
|
2017-05-18 05:25:54 -04:00
|
|
|
|
2017-05-26 10:02:13 -04:00
|
|
|
configure(extensions.findByName("${baseName}#oldClusterTestCluster")) {
|
2019-04-01 16:23:24 -04:00
|
|
|
dependsOn copyTestNodeKeyMaterial
|
|
|
|
if (version.before('6.3.0')) {
|
|
|
|
String depVersion = version;
|
|
|
|
if (project.bwcVersions.unreleased.contains(version)) {
|
|
|
|
depVersion += "-SNAPSHOT"
|
|
|
|
}
|
|
|
|
mavenPlugin 'x-pack', "org.elasticsearch.plugin:x-pack:${depVersion}"
|
2017-08-01 15:48:04 -04:00
|
|
|
}
|
2019-04-01 16:23:24 -04:00
|
|
|
String usersCli = version.before('6.3.0') ? 'bin/x-pack/users' : 'bin/elasticsearch-users'
|
|
|
|
setupCommand 'setupTestUser', usersCli, 'useradd', 'test_user', '-p', 'x-pack-test-password', '-r', 'superuser'
|
|
|
|
bwcVersion = version
|
|
|
|
numBwcNodes = 3
|
|
|
|
numNodes = 3
|
2018-06-06 11:59:16 -04:00
|
|
|
clusterName = 'rolling-upgrade'
|
|
|
|
waitCondition = waitWithAuth
|
|
|
|
setting 'xpack.monitoring.exporters._http.type', 'http'
|
|
|
|
setting 'xpack.monitoring.exporters._http.enabled', 'false'
|
|
|
|
setting 'xpack.monitoring.exporters._http.auth.username', 'test_user'
|
|
|
|
setting 'xpack.monitoring.exporters._http.auth.password', 'x-pack-test-password'
|
|
|
|
setting 'xpack.license.self_generated.type', 'trial'
|
|
|
|
setting 'xpack.security.enabled', 'true'
|
|
|
|
setting 'xpack.security.transport.ssl.enabled', 'true'
|
2019-04-01 16:23:24 -04:00
|
|
|
setting 'xpack.security.authc.token.enabled', 'true'
|
2019-05-01 07:53:56 -04:00
|
|
|
setting 'xpack.security.authc.token.timeout', '60m'
|
2019-04-01 16:23:24 -04:00
|
|
|
setting 'xpack.security.audit.enabled', 'true'
|
2019-05-30 13:29:42 -04:00
|
|
|
rootProject.globalInfo.ready {
|
|
|
|
if (project.inFipsJvm) {
|
|
|
|
setting 'xpack.security.transport.ssl.key', 'testnode.pem'
|
|
|
|
setting 'xpack.security.transport.ssl.certificate', 'testnode.crt'
|
|
|
|
keystoreSetting 'xpack.security.transport.ssl.secure_key_passphrase', 'testnode'
|
|
|
|
} else {
|
|
|
|
setting 'xpack.security.transport.ssl.keystore.path', 'testnode.jks'
|
|
|
|
setting 'xpack.security.transport.ssl.keystore.password', 'testnode'
|
|
|
|
}
|
2019-03-18 02:52:14 -04:00
|
|
|
}
|
|
|
|
dependsOn copyTestNodeKeyMaterial
|
2018-06-06 11:59:16 -04:00
|
|
|
extraConfigFile 'testnode.jks', new File(outputDir + '/testnode.jks')
|
2019-03-18 02:52:14 -04:00
|
|
|
extraConfigFile 'testnode.pem', new File(outputDir + '/testnode.pem')
|
|
|
|
extraConfigFile 'testnode.crt', new File(outputDir + '/testnode.crt')
|
2019-04-01 16:23:24 -04:00
|
|
|
if (version.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'
|
|
|
|
}
|
|
|
|
|
|
|
|
keystoreFile 'xpack.watcher.encryption_key', "${project.projectDir}/src/test/resources/system_key"
|
|
|
|
setting 'xpack.watcher.encrypt_sensitive_data', 'true'
|
|
|
|
|
|
|
|
if (version.onOrAfter('6.6.0')) {
|
|
|
|
setting 'ccr.auto_follow.wait_for_metadata_timeout', '1s'
|
2018-06-06 11:59:16 -04:00
|
|
|
}
|
2019-04-01 16:23:24 -04:00
|
|
|
|
|
|
|
// 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 (version.before('5.6.9') || (version.onOrAfter('6.0.0') && version.before('6.2.4'))) {
|
|
|
|
jvmArgs '-da:org.elasticsearch.xpack.monitoring.exporter.http.HttpExportBulk'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Task oldClusterTestRunner = tasks.getByName("${baseName}#oldClusterTestRunner")
|
|
|
|
oldClusterTestRunner.configure {
|
|
|
|
systemProperty 'tests.rest.suite', 'old_cluster'
|
[7.x Backport] Force selection of calendar or fixed intervals (#41906)
The date_histogram accepts an interval which can be either a calendar
interval (DST-aware, leap seconds, arbitrary length of months, etc) or
fixed interval (strict multiples of SI units). Unfortunately this is inferred
by first trying to parse as a calendar interval, then falling back to fixed
if that fails.
This leads to confusing arrangement where `1d` == calendar, but
`2d` == fixed. And if you want a day of fixed time, you have to
specify `24h` (e.g. the next smallest unit). This arrangement is very
error-prone for users.
This PR adds `calendar_interval` and `fixed_interval` parameters to any
code that uses intervals (date_histogram, rollup, composite, datafeed, etc).
Calendar only accepts calendar intervals, fixed accepts any combination of
units (meaning `1d` can be used to specify `24h` in fixed time), and both
are mutually exclusive.
The old interval behavior is deprecated and will throw a deprecation warning.
It is also mutually exclusive with the two new parameters. In the future the
old dual-purpose interval will be removed.
The change applies to both REST and java clients.
2019-05-20 12:07:29 -04:00
|
|
|
systemProperty 'tests.upgrade_from_version', version.toString().replace('-SNAPSHOT', '')
|
2019-04-01 16:23:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
Closure configureUpgradeCluster = {String name, Task lastRunner, int stopNode, Closure getOtherUnicastHostAddresses ->
|
|
|
|
configure(extensions.findByName("${baseName}#${name}")) {
|
|
|
|
dependsOn lastRunner, "${baseName}#oldClusterTestCluster#node${stopNode}.stop"
|
|
|
|
setupCommand 'setupTestUser', 'bin/elasticsearch-users', 'useradd', 'test_user', '-p', 'x-pack-test-password', '-r', 'superuser'
|
|
|
|
clusterName = 'rolling-upgrade'
|
|
|
|
otherUnicastHostAddresses = { getOtherUnicastHostAddresses() }
|
|
|
|
minimumMasterNodes = { 2 }
|
|
|
|
autoSetInitialMasterNodes = false
|
|
|
|
/* Override the data directory so the new node always gets the node we
|
|
|
|
* just stopped's data directory. */
|
|
|
|
dataDir = { nodeNumber -> oldClusterTest.nodes[stopNode].dataDir }
|
|
|
|
waitCondition = waitWithAuth
|
|
|
|
setting 'xpack.monitoring.exporters._http.type', 'http'
|
|
|
|
setting 'xpack.monitoring.exporters._http.enabled', 'false'
|
|
|
|
setting 'xpack.monitoring.exporters._http.auth.username', 'test_user'
|
|
|
|
setting 'xpack.monitoring.exporters._http.auth.password', 'x-pack-test-password'
|
|
|
|
setting 'xpack.license.self_generated.type', 'trial'
|
|
|
|
setting 'xpack.security.enabled', 'true'
|
|
|
|
setting 'xpack.security.transport.ssl.enabled', 'true'
|
2019-05-01 07:53:56 -04:00
|
|
|
setting 'xpack.security.authc.token.timeout', '60m'
|
2019-05-30 13:29:42 -04:00
|
|
|
rootProject.globalInfo.ready {
|
|
|
|
if (project.inFipsJvm) {
|
|
|
|
setting 'xpack.security.transport.ssl.key', 'testnode.pem'
|
|
|
|
setting 'xpack.security.transport.ssl.certificate', 'testnode.crt'
|
|
|
|
keystoreSetting 'xpack.security.transport.ssl.secure_key_passphrase', 'testnode'
|
|
|
|
} else {
|
|
|
|
setting 'xpack.security.transport.ssl.keystore.path', 'testnode.jks'
|
|
|
|
setting 'xpack.security.transport.ssl.keystore.password', 'testnode'
|
|
|
|
}
|
2019-04-01 16:23:24 -04:00
|
|
|
}
|
|
|
|
setting 'node.attr.upgraded', 'true'
|
|
|
|
setting 'xpack.security.authc.token.enabled', 'true'
|
|
|
|
setting 'xpack.security.audit.enabled', 'true'
|
|
|
|
setting 'node.name', "upgraded-node-${stopNode}"
|
|
|
|
dependsOn copyTestNodeKeyMaterial
|
|
|
|
extraConfigFile 'testnode.jks', new File(outputDir + '/testnode.jks')
|
|
|
|
extraConfigFile 'testnode.pem', new File(outputDir + '/testnode.pem')
|
|
|
|
extraConfigFile 'testnode.crt', new File(outputDir + '/testnode.crt')
|
|
|
|
setting 'xpack.security.authc.realms.file.file1.order', '0'
|
|
|
|
setting 'xpack.security.authc.realms.native.native1.order', '1'
|
|
|
|
setting 'xpack.watcher.encrypt_sensitive_data', 'true'
|
|
|
|
keystoreFile 'xpack.watcher.encryption_key', "${project.projectDir}/src/test/resources/system_key"
|
2018-08-27 12:56:21 -04:00
|
|
|
}
|
2017-05-26 10:02:13 -04:00
|
|
|
}
|
2017-02-22 03:56:52 -05:00
|
|
|
|
2018-06-06 11:59:16 -04:00
|
|
|
Task oneThirdUpgradedTest = tasks.create(name: "${baseName}#oneThirdUpgradedTest", type: RestIntegTestTask)
|
|
|
|
|
2018-06-07 13:05:36 -04:00
|
|
|
configureUpgradeCluster("oneThirdUpgradedTestCluster", oldClusterTestRunner, 0,
|
2019-04-01 16:23:24 -04:00
|
|
|
// Use all running nodes as seed nodes so there is no race between pinging and the tests
|
|
|
|
{ [oldClusterTest.nodes.get(1).transportUri(), oldClusterTest.nodes.get(2).transportUri()] })
|
2018-06-06 11:59:16 -04:00
|
|
|
|
|
|
|
Task oneThirdUpgradedTestRunner = tasks.getByName("${baseName}#oneThirdUpgradedTestRunner")
|
|
|
|
oneThirdUpgradedTestRunner.configure {
|
2019-04-01 16:23:24 -04:00
|
|
|
systemProperty 'tests.rest.suite', 'mixed_cluster'
|
|
|
|
systemProperty 'tests.first_round', 'true'
|
[7.x Backport] Force selection of calendar or fixed intervals (#41906)
The date_histogram accepts an interval which can be either a calendar
interval (DST-aware, leap seconds, arbitrary length of months, etc) or
fixed interval (strict multiples of SI units). Unfortunately this is inferred
by first trying to parse as a calendar interval, then falling back to fixed
if that fails.
This leads to confusing arrangement where `1d` == calendar, but
`2d` == fixed. And if you want a day of fixed time, you have to
specify `24h` (e.g. the next smallest unit). This arrangement is very
error-prone for users.
This PR adds `calendar_interval` and `fixed_interval` parameters to any
code that uses intervals (date_histogram, rollup, composite, datafeed, etc).
Calendar only accepts calendar intervals, fixed accepts any combination of
units (meaning `1d` can be used to specify `24h` in fixed time), and both
are mutually exclusive.
The old interval behavior is deprecated and will throw a deprecation warning.
It is also mutually exclusive with the two new parameters. In the future the
old dual-purpose interval will be removed.
The change applies to both REST and java clients.
2019-05-20 12:07:29 -04:00
|
|
|
systemProperty 'tests.upgrade_from_version', version.toString().replace('-SNAPSHOT', '')
|
2019-04-01 16:23:24 -04:00
|
|
|
// We only need to run these tests once so we may as well do it when we're two thirds upgraded
|
|
|
|
systemProperty 'tests.rest.blacklist', [
|
2019-04-02 08:04:33 -04:00
|
|
|
'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'
|
2018-06-06 11:59:16 -04:00
|
|
|
].join(',')
|
2019-04-01 16:23:24 -04:00
|
|
|
finalizedBy "${baseName}#oldClusterTestCluster#node1.stop"
|
2017-05-26 10:02:13 -04:00
|
|
|
}
|
2016-11-22 12:00:09 -05:00
|
|
|
|
2018-06-06 11:59:16 -04:00
|
|
|
Task twoThirdsUpgradedTest = tasks.create(name: "${baseName}#twoThirdsUpgradedTest", type: RestIntegTestTask)
|
2017-05-26 10:02:13 -04:00
|
|
|
|
2018-06-07 13:05:36 -04:00
|
|
|
configureUpgradeCluster("twoThirdsUpgradedTestCluster", oneThirdUpgradedTestRunner, 1,
|
2019-04-01 16:23:24 -04:00
|
|
|
// Use all running nodes as seed nodes so there is no race between pinging and the tests
|
|
|
|
{ [oldClusterTest.nodes.get(2).transportUri(), oneThirdUpgradedTest.nodes.get(0).transportUri()] })
|
2018-06-06 11:59:16 -04:00
|
|
|
|
|
|
|
Task twoThirdsUpgradedTestRunner = tasks.getByName("${baseName}#twoThirdsUpgradedTestRunner")
|
|
|
|
twoThirdsUpgradedTestRunner.configure {
|
2019-04-01 16:23:24 -04:00
|
|
|
systemProperty 'tests.rest.suite', 'mixed_cluster'
|
|
|
|
systemProperty 'tests.first_round', 'false'
|
[7.x Backport] Force selection of calendar or fixed intervals (#41906)
The date_histogram accepts an interval which can be either a calendar
interval (DST-aware, leap seconds, arbitrary length of months, etc) or
fixed interval (strict multiples of SI units). Unfortunately this is inferred
by first trying to parse as a calendar interval, then falling back to fixed
if that fails.
This leads to confusing arrangement where `1d` == calendar, but
`2d` == fixed. And if you want a day of fixed time, you have to
specify `24h` (e.g. the next smallest unit). This arrangement is very
error-prone for users.
This PR adds `calendar_interval` and `fixed_interval` parameters to any
code that uses intervals (date_histogram, rollup, composite, datafeed, etc).
Calendar only accepts calendar intervals, fixed accepts any combination of
units (meaning `1d` can be used to specify `24h` in fixed time), and both
are mutually exclusive.
The old interval behavior is deprecated and will throw a deprecation warning.
It is also mutually exclusive with the two new parameters. In the future the
old dual-purpose interval will be removed.
The change applies to both REST and java clients.
2019-05-20 12:07:29 -04:00
|
|
|
systemProperty 'tests.upgrade_from_version', version.toString().replace('-SNAPSHOT', '')
|
2019-04-01 16:23:24 -04:00
|
|
|
finalizedBy "${baseName}#oldClusterTestCluster#node2.stop"
|
2017-05-26 10:02:13 -04:00
|
|
|
}
|
2017-02-22 03:56:52 -05:00
|
|
|
|
2018-06-06 11:59:16 -04:00
|
|
|
Task upgradedClusterTest = tasks.create(name: "${baseName}#upgradedClusterTest", type: RestIntegTestTask)
|
|
|
|
|
2018-06-07 13:05:36 -04:00
|
|
|
configureUpgradeCluster("upgradedClusterTestCluster", twoThirdsUpgradedTestRunner, 2,
|
2019-04-01 16:23:24 -04:00
|
|
|
// Use all running nodes as seed nodes so there is no race between pinging and the tests
|
|
|
|
{ [oneThirdUpgradedTest.nodes.get(0).transportUri(), twoThirdsUpgradedTest.nodes.get(0).transportUri()] })
|
2018-06-06 11:59:16 -04:00
|
|
|
|
2017-05-26 10:02:13 -04:00
|
|
|
Task upgradedClusterTestRunner = tasks.getByName("${baseName}#upgradedClusterTestRunner")
|
|
|
|
upgradedClusterTestRunner.configure {
|
2019-04-01 16:23:24 -04:00
|
|
|
systemProperty 'tests.rest.suite', 'upgraded_cluster'
|
[7.x Backport] Force selection of calendar or fixed intervals (#41906)
The date_histogram accepts an interval which can be either a calendar
interval (DST-aware, leap seconds, arbitrary length of months, etc) or
fixed interval (strict multiples of SI units). Unfortunately this is inferred
by first trying to parse as a calendar interval, then falling back to fixed
if that fails.
This leads to confusing arrangement where `1d` == calendar, but
`2d` == fixed. And if you want a day of fixed time, you have to
specify `24h` (e.g. the next smallest unit). This arrangement is very
error-prone for users.
This PR adds `calendar_interval` and `fixed_interval` parameters to any
code that uses intervals (date_histogram, rollup, composite, datafeed, etc).
Calendar only accepts calendar intervals, fixed accepts any combination of
units (meaning `1d` can be used to specify `24h` in fixed time), and both
are mutually exclusive.
The old interval behavior is deprecated and will throw a deprecation warning.
It is also mutually exclusive with the two new parameters. In the future the
old dual-purpose interval will be removed.
The change applies to both REST and java clients.
2019-05-20 12:07:29 -04:00
|
|
|
systemProperty 'tests.upgrade_from_version', version.toString().replace('-SNAPSHOT', '')
|
2019-04-01 16:23:24 -04:00
|
|
|
/*
|
|
|
|
* Force stopping all the upgraded nodes after the test runner
|
|
|
|
* so they are alive during the test.
|
|
|
|
*/
|
|
|
|
finalizedBy "${baseName}#oneThirdUpgradedTestCluster#stop"
|
|
|
|
finalizedBy "${baseName}#twoThirdsUpgradedTestCluster#stop"
|
|
|
|
|
|
|
|
// migration tests should only run when the original/old cluster nodes where versions < 5.2.0.
|
|
|
|
// this stinks but we do the check here since our rest tests do not support conditionals
|
|
|
|
// otherwise we could check the index created version
|
|
|
|
String versionStr = project.extensions.findByName("${baseName}#oldClusterTestCluster").properties.get('bwcVersion')
|
|
|
|
String[] versionParts = versionStr.split('\\.')
|
|
|
|
if (versionParts[0].equals("5")) {
|
|
|
|
Integer minor = Integer.parseInt(versionParts[1])
|
|
|
|
if (minor >= 2) {
|
|
|
|
systemProperty 'tests.rest.blacklist', '/20_security/Verify default password migration results in upgraded cluster'
|
|
|
|
}
|
|
|
|
}
|
2017-05-18 14:39:36 -04:00
|
|
|
}
|
2016-11-22 12:00:09 -05:00
|
|
|
|
2017-05-26 10:02:13 -04:00
|
|
|
Task versionBwcTest = tasks.create(name: "${baseName}#bwcTest") {
|
2019-04-01 16:23:24 -04:00
|
|
|
dependsOn = [upgradedClusterTest]
|
2017-05-26 10:02:13 -04:00
|
|
|
}
|
2017-05-18 05:25:54 -04:00
|
|
|
|
2017-06-15 07:45:20 -04:00
|
|
|
if (project.bwc_tests_enabled) {
|
2019-04-01 16:23:24 -04:00
|
|
|
bwcTest.dependsOn(versionBwcTest)
|
2017-06-15 07:45:20 -04:00
|
|
|
}
|
2019-04-01 16:23:24 -04:00
|
|
|
}
|
2016-11-22 12:00:09 -05:00
|
|
|
|
2019-04-01 16:23:24 -04:00
|
|
|
// basic integ tests includes testing bwc against the most recent version
|
|
|
|
task bwcTestSnapshots {
|
2017-06-15 07:45:20 -04:00
|
|
|
if (project.bwc_tests_enabled) {
|
2019-04-01 16:23:24 -04:00
|
|
|
for (final def version : bwcVersions.unreleasedWireCompatible) {
|
|
|
|
dependsOn "v${version}#bwcTest"
|
|
|
|
}
|
2017-06-15 07:45:20 -04:00
|
|
|
}
|
2019-04-01 16:23:24 -04:00
|
|
|
}
|
|
|
|
check.dependsOn(bwcTestSnapshots)
|
2018-01-17 14:18:44 -05:00
|
|
|
|
2019-04-01 16:23:24 -04:00
|
|
|
// copy x-pack plugin info so it is on the classpath and security manager has the right permissions
|
|
|
|
task copyXPackRestSpec(type: Copy) {
|
2017-01-09 16:06:50 -05:00
|
|
|
dependsOn(project.configurations.restSpec, 'processTestResources')
|
2018-01-27 00:48:30 -05:00
|
|
|
from project(xpackProject('plugin').path).sourceSets.test.resources
|
2017-01-09 16:06:50 -05:00
|
|
|
include 'rest-api-spec/api/**'
|
|
|
|
into project.sourceSets.test.output.resourcesDir
|
2019-04-01 16:23:24 -04:00
|
|
|
}
|
2019-04-15 13:14:43 -04:00
|
|
|
project.sourceSets.test.output.dir(outputDir, builtBy: copyXPackRestSpec)
|