Backport testclusters all (#47565)
* Bwc testclusters all (#46265) Convert all bwc projects to testclusters * Fix bwc versions config * WIP fix rolling upgrade * Fix bwc tests on old versions * Fix rolling upgrade
This commit is contained in:
parent
8c180a77f0
commit
2b16d7bcf8
|
@ -255,7 +255,7 @@ public class DistributionDownloadPlugin implements Plugin<Project> {
|
|||
Platform platform = distribution.getPlatform();
|
||||
projectName += platform.toString() + (platform == Platform.WINDOWS ? "-zip" : "-tar");
|
||||
} else {
|
||||
projectName = "zip";
|
||||
projectName = distribution.getFlavor().equals(Flavor.DEFAULT) ?"zip" : "oss-zip";
|
||||
}
|
||||
} else {
|
||||
projectName += distribution.getType();
|
||||
|
|
|
@ -273,31 +273,7 @@ public class ElasticsearchCluster implements TestClusterConfiguration, Named {
|
|||
for (ElasticsearchNode node : nodes) {
|
||||
// Can only configure master nodes if we have node names defined
|
||||
if (nodeNames != null) {
|
||||
if (node.getVersion().onOrAfter("7.0.0")) {
|
||||
node.defaultConfig.keySet().stream()
|
||||
.filter(name -> name.startsWith("discovery.zen."))
|
||||
.collect(Collectors.toList())
|
||||
.forEach(node.defaultConfig::remove);
|
||||
node.defaultConfig.put("cluster.initial_master_nodes", "[" + nodeNames + "]");
|
||||
node.defaultConfig.put("discovery.seed_providers", "file");
|
||||
node.defaultConfig.put("discovery.seed_hosts", "[]");
|
||||
} else {
|
||||
node.defaultConfig.put("discovery.zen.master_election.wait_for_joins_timeout", "5s");
|
||||
if (nodes.size() > 1) {
|
||||
node.defaultConfig.put("discovery.zen.minimum_master_nodes", Integer.toString(nodes.size() / 2 + 1));
|
||||
}
|
||||
if (node.getVersion().onOrAfter("6.5.0")) {
|
||||
node.defaultConfig.put("discovery.zen.hosts_provider", "file");
|
||||
node.defaultConfig.put("discovery.zen.ping.unicast.hosts", "[]");
|
||||
} else {
|
||||
if (firstNode == null) {
|
||||
node.defaultConfig.put("discovery.zen.ping.unicast.hosts", "[]");
|
||||
} else {
|
||||
firstNode.waitForAllConditions();
|
||||
node.defaultConfig.put("discovery.zen.ping.unicast.hosts", "[\"" + firstNode.getTransportPortURI() + "\"]");
|
||||
}
|
||||
}
|
||||
}
|
||||
commonNodeConfig(node, nodeNames, firstNode);
|
||||
}
|
||||
if (firstNode == null) {
|
||||
firstNode = node;
|
||||
|
@ -309,6 +285,36 @@ public class ElasticsearchCluster implements TestClusterConfiguration, Named {
|
|||
}
|
||||
}
|
||||
|
||||
private void commonNodeConfig(ElasticsearchNode node, String nodeNames, ElasticsearchNode firstNode) {
|
||||
if (node.getVersion().onOrAfter("7.0.0")) {
|
||||
node.defaultConfig.keySet().stream()
|
||||
.filter(name -> name.startsWith("discovery.zen."))
|
||||
.collect(Collectors.toList())
|
||||
.forEach(node.defaultConfig::remove);
|
||||
if (nodeNames != null) {
|
||||
node.defaultConfig.put("cluster.initial_master_nodes", "[" + nodeNames + "]");
|
||||
}
|
||||
node.defaultConfig.put("discovery.seed_providers", "file");
|
||||
node.defaultConfig.put("discovery.seed_hosts", "[]");
|
||||
} else {
|
||||
node.defaultConfig.put("discovery.zen.master_election.wait_for_joins_timeout", "5s");
|
||||
if (nodes.size() > 1) {
|
||||
node.defaultConfig.put("discovery.zen.minimum_master_nodes", Integer.toString(nodes.size() / 2 + 1));
|
||||
}
|
||||
if (node.getVersion().onOrAfter("6.5.0")) {
|
||||
node.defaultConfig.put("discovery.zen.hosts_provider", "file");
|
||||
node.defaultConfig.put("discovery.zen.ping.unicast.hosts", "[]");
|
||||
} else {
|
||||
if (firstNode == null) {
|
||||
node.defaultConfig.put("discovery.zen.ping.unicast.hosts", "[]");
|
||||
} else {
|
||||
firstNode.waitForAllConditions();
|
||||
node.defaultConfig.put("discovery.zen.ping.unicast.hosts", "[\"" + firstNode.getTransportPortURI() + "\"]");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restart() {
|
||||
nodes.forEach(ElasticsearchNode::restart);
|
||||
|
@ -328,7 +334,24 @@ public class ElasticsearchCluster implements TestClusterConfiguration, Named {
|
|||
ElasticsearchNode node = nodes.getByName(clusterName + "-" + nodeIndex);
|
||||
node.stop(false);
|
||||
node.goToNextVersion();
|
||||
commonNodeConfig();
|
||||
commonNodeConfig(node, null, null);
|
||||
// We need to translate these settings there as there's no support to do per version config for testclusters yet
|
||||
if (node.getVersion().onOrAfter("7.0.0")) {
|
||||
if (node.settings.containsKey("xpack.security.authc.realms.file1.type")) {
|
||||
node.settings.remove("xpack.security.authc.realms.file1.type");
|
||||
node.settings.put(
|
||||
"xpack.security.authc.realms.file.file1.order",
|
||||
node.settings.remove("xpack.security.authc.realms.file1.order")
|
||||
);
|
||||
}
|
||||
if (node.settings.containsKey("xpack.security.authc.realms.native1.type")) {
|
||||
node.settings.remove("xpack.security.authc.realms.native1.type");
|
||||
node.settings.put(
|
||||
"xpack.security.authc.realms.native.native1.order",
|
||||
node.settings.remove("xpack.security.authc.realms.native1.order")
|
||||
);
|
||||
}
|
||||
}
|
||||
nodeIndex += 1;
|
||||
node.start();
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ public class ElasticsearchNode implements TestClusterConfiguration {
|
|||
private final LinkedHashMap<String, Predicate<TestClusterConfiguration>> waitConditions = new LinkedHashMap<>();
|
||||
private final List<URI> plugins = new ArrayList<>();
|
||||
private final List<File> modules = new ArrayList<>();
|
||||
private final LazyPropertyMap<String, CharSequence> settings = new LazyPropertyMap<>("Settings", this);
|
||||
final LazyPropertyMap<String, CharSequence> settings = new LazyPropertyMap<>("Settings", this);
|
||||
private final LazyPropertyMap<String, CharSequence> keystoreSettings = new LazyPropertyMap<>("Keystore", this);
|
||||
private final LazyPropertyMap<String, File> keystoreFiles = new LazyPropertyMap<>("Keystore files", this, FileEntry::new);
|
||||
private final LazyPropertyMap<String, CharSequence> systemProperties = new LazyPropertyMap<>("System properties", this);
|
||||
|
@ -732,6 +732,17 @@ public class ElasticsearchNode implements TestClusterConfiguration {
|
|||
|
||||
@Override
|
||||
public synchronized void stop(boolean tailLogs) {
|
||||
logToProcessStdout("Stopping node");
|
||||
try {
|
||||
if (Files.exists(httpPortsFile)) {
|
||||
Files.delete(httpPortsFile);
|
||||
}
|
||||
if (Files.exists(transportPortFile)) {
|
||||
Files.delete(transportPortFile);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new UncheckedIOException(e);
|
||||
}
|
||||
if (esProcess == null && tailLogs) {
|
||||
// This is a special case. If start() throws an exception the plugin will still call stop
|
||||
// Another exception here would eat the orriginal.
|
||||
|
@ -894,6 +905,8 @@ public class ElasticsearchNode implements TestClusterConfiguration {
|
|||
|
||||
private void createWorkingDir(Path distroExtractDir) throws IOException {
|
||||
syncWithLinks(distroExtractDir, distroDir);
|
||||
// Start configuration from scratch in case of a restart
|
||||
project.delete(configFile.getParent());
|
||||
Files.createDirectories(configFile.getParent());
|
||||
Files.createDirectories(confPathRepo);
|
||||
Files.createDirectories(confPathData);
|
||||
|
|
|
@ -15,6 +15,10 @@ public class VersionProperties {
|
|||
return elasticsearch;
|
||||
}
|
||||
|
||||
public static Version getElasticsearchVersion() {
|
||||
return Version.fromString(elasticsearch);
|
||||
}
|
||||
|
||||
public static String getLucene() {
|
||||
return lucene;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,11 @@ subprojects { Project subproj ->
|
|||
}
|
||||
plugins.withType(TestClustersPlugin).whenPluginAdded {
|
||||
testClusters.all {
|
||||
testDistribution = System.getProperty('tests.distribution', 'oss').toUpperCase()
|
||||
String configuredTestDistribution = System.getProperty('tests.distribution', 'oss').toUpperCase()
|
||||
testDistribution = configuredTestDistribution
|
||||
if (configuredTestDistribution.equals("DEFAULT")) {
|
||||
setting "xpack.security.enabled", "false"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,12 +22,10 @@ import org.elasticsearch.gradle.Version
|
|||
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask
|
||||
import org.elasticsearch.gradle.testclusters.TestDistribution
|
||||
|
||||
apply plugin: 'elasticsearch.standalone-test'
|
||||
apply plugin: 'elasticsearch.testclusters'
|
||||
apply plugin: 'elasticsearch.standalone-test'
|
||||
|
||||
// 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 {
|
||||
tasks.register("bwcTest") {
|
||||
description = 'Runs backwards compatibility tests.'
|
||||
group = 'verification'
|
||||
}
|
||||
|
@ -36,18 +34,13 @@ for (Version bwcVersion : bwcVersions.indexCompatible) {
|
|||
String baseName = "v${bwcVersion}"
|
||||
|
||||
testClusters {
|
||||
String configuredTestDistribution = System.getProperty('tests.distribution', 'oss').toUpperCase()
|
||||
"${baseName}" {
|
||||
testDistribution = configuredTestDistribution
|
||||
versions = [ bwcVersion.toString(), project.version ]
|
||||
numberOfNodes = 2
|
||||
// some tests rely on the translog not being flushed
|
||||
setting 'indices.memory.shard_inactive_time', '20m'
|
||||
setting 'http.content_type.required', 'true'
|
||||
setting 'path.repo', "${buildDir}/cluster/shared/repo/${baseName}"
|
||||
if (configuredTestDistribution.equals("DEFAULT")) {
|
||||
setting "xpack.security.enabled", "false"
|
||||
}
|
||||
javaHome = project.file(project.ext.runtimeJavaHome)
|
||||
}
|
||||
}
|
||||
|
@ -87,9 +80,6 @@ for (Version bwcVersion : bwcVersions.indexCompatible) {
|
|||
}
|
||||
}
|
||||
|
||||
test.enabled = false // no unit tests for rolling upgrades, only the rest integration test
|
||||
|
||||
// basic integ tests includes testing bwc against the most recent version
|
||||
task bwcTestSnapshots {
|
||||
if (project.bwc_tests_enabled) {
|
||||
for (final def version : bwcVersions.unreleasedIndexCompatible) {
|
||||
|
@ -112,3 +102,5 @@ task testJar(type: Jar) {
|
|||
artifacts {
|
||||
testArtifacts testJar
|
||||
}
|
||||
|
||||
test.enabled = false
|
|
@ -17,58 +17,89 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import org.elasticsearch.gradle.test.RestIntegTestTask
|
||||
import org.elasticsearch.gradle.Version
|
||||
import org.elasticsearch.gradle.VersionProperties
|
||||
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask
|
||||
|
||||
apply plugin: 'elasticsearch.testclusters'
|
||||
apply plugin: 'elasticsearch.standalone-test'
|
||||
|
||||
// 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 {
|
||||
tasks.register("bwcTest") {
|
||||
description = 'Runs backwards compatibility tests.'
|
||||
group = 'verification'
|
||||
}
|
||||
|
||||
for (Version version : bwcVersions.wireCompatible) {
|
||||
String baseName = "v${version}"
|
||||
configurations {
|
||||
restSpec
|
||||
}
|
||||
|
||||
Task mixedClusterTest = tasks.create(name: "${baseName}#mixedClusterTest", type: RestIntegTestTask) {
|
||||
mustRunAfter(precommit)
|
||||
includePackaged = true
|
||||
dependencies {
|
||||
restSpec project(':rest-api-spec')
|
||||
}
|
||||
|
||||
processTestResources {
|
||||
from ({ zipTree(configurations.restSpec.singleFile) })
|
||||
dependsOn configurations.restSpec
|
||||
}
|
||||
|
||||
for (Version bwcVersion : bwcVersions.wireCompatible) {
|
||||
if (bwcVersion == VersionProperties.getElasticsearchVersion()) {
|
||||
// Not really a mixed cluster
|
||||
continue ;
|
||||
}
|
||||
|
||||
String baseName = "v${bwcVersion}"
|
||||
|
||||
/* This project runs the core REST tests against a 4 node cluster where two of
|
||||
the nodes has a different minor. */
|
||||
Object extension = extensions.findByName("${baseName}#mixedClusterTestCluster")
|
||||
configure(extension) {
|
||||
numNodes = 4
|
||||
numBwcNodes = 2
|
||||
bwcVersion = version
|
||||
testClusters {
|
||||
"${baseName}" {
|
||||
versions = [ bwcVersion.toString(), project.version ]
|
||||
numberOfNodes = 4
|
||||
|
||||
setting 'path.repo', "${buildDir}/cluster/shared/repo/${baseName}"
|
||||
javaHome = project.file(project.ext.runtimeJavaHome)
|
||||
}
|
||||
}
|
||||
|
||||
Task versionBwcTest = tasks.create(name: "${baseName}#bwcTest") {
|
||||
dependsOn = [mixedClusterTest]
|
||||
tasks.register("${baseName}#mixedClusterTest", RestTestRunnerTask) {
|
||||
useCluster testClusters."${baseName}"
|
||||
mustRunAfter(precommit)
|
||||
doFirst {
|
||||
project.delete("${buildDir}/cluster/shared/repo/${baseName}")
|
||||
// Getting the endpoints causes a wait for the cluster
|
||||
println "Test cluster endpoints are: ${-> testClusters."${baseName}".allHttpSocketURI.join(",") }"
|
||||
println "Upgrading one node to create a mixed cluster"
|
||||
testClusters."${baseName}".nextNodeToNextVersion()
|
||||
// Getting the endpoints causes a wait for the cluster
|
||||
println "Upgrade complete, endpoints are: ${-> testClusters."${baseName}".allHttpSocketURI.join(",") }"
|
||||
println "Upgrading another node to create a mixed cluster"
|
||||
testClusters."${baseName}".nextNodeToNextVersion()
|
||||
|
||||
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",") }")
|
||||
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName() }")
|
||||
}
|
||||
systemProperty 'tests.path.repo', "${buildDir}/cluster/shared/repo/${baseName}"
|
||||
onlyIf { project.bwc_tests_enabled }
|
||||
}
|
||||
|
||||
if (project.bwc_tests_enabled) {
|
||||
bwcTest.dependsOn(versionBwcTest)
|
||||
tasks.register("${baseName}#bwcTest") {
|
||||
dependsOn "${baseName}#mixedClusterTest"
|
||||
}
|
||||
|
||||
tasks.getByName("${baseName}#mixedClusterTestRunner").configure {
|
||||
/* To support taking index snapshots, we have to set path.repo setting */
|
||||
systemProperty 'tests.path.repo', new File(buildDir, "cluster/shared/repo")
|
||||
}
|
||||
tasks.bwcTest.dependsOn "${baseName}#bwcTest"
|
||||
}
|
||||
|
||||
test.enabled = false // no unit tests for rolling upgrades, only the rest integration test
|
||||
|
||||
// basic integ tests includes testing bwc against the most recent version
|
||||
task bwcTestSnapshots {
|
||||
if (project.bwc_tests_enabled) {
|
||||
for (final def version : bwcVersions.unreleasedWireCompatible) {
|
||||
dependsOn "v${version}#bwcTest"
|
||||
for (Version bwcVersion : bwcVersions.unreleasedWireCompatible) {
|
||||
if (bwcVersion != VersionProperties.getElasticsearchVersion()) {
|
||||
dependsOn "v${bwcVersion}#bwcTest"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
check.dependsOn(bwcTestSnapshots)
|
||||
|
||||
test.enabled = false
|
||||
|
|
|
@ -17,9 +17,10 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import org.elasticsearch.gradle.test.RestIntegTestTask
|
||||
import org.elasticsearch.gradle.Version
|
||||
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask
|
||||
|
||||
apply plugin: 'elasticsearch.testclusters'
|
||||
apply plugin: 'elasticsearch.standalone-test'
|
||||
|
||||
// This is a top level task which we will add dependencies to below.
|
||||
|
@ -29,117 +30,105 @@ task bwcTest {
|
|||
group = 'verification'
|
||||
}
|
||||
|
||||
for (Version version : bwcVersions.wireCompatible) {
|
||||
configurations {
|
||||
restSpec
|
||||
}
|
||||
|
||||
dependencies {
|
||||
restSpec project(':rest-api-spec')
|
||||
}
|
||||
|
||||
processTestResources {
|
||||
from ({ zipTree(configurations.restSpec.singleFile) }) {
|
||||
include 'rest-api-spec/api/**'
|
||||
}
|
||||
dependsOn configurations.restSpec
|
||||
}
|
||||
|
||||
for (Version bwcVersion : bwcVersions.wireCompatible) {
|
||||
/*
|
||||
* The goal here is to:
|
||||
* <ul>
|
||||
* <li>start three nodes on the old version
|
||||
* <li>run tests with systemProperty 'tests.rest.suite', 'old_cluster'
|
||||
* <li>shut down one node
|
||||
* <li>start a node with the new version
|
||||
* <li>upgrade one node
|
||||
* <li>run tests with systemProperty 'tests.rest.suite', 'mixed_cluster'
|
||||
* <li>shut down one node on the old version
|
||||
* <li>start a node with the new version
|
||||
* <li>upgrade one more node
|
||||
* <li>run tests with systemProperty 'tests.rest.suite', 'mixed_cluster' again
|
||||
* <li>shut down the last node with the old version
|
||||
* <li>start a node with the new version
|
||||
* <li>updgrade the last node
|
||||
* <li>run tests with systemProperty 'tests.rest.suite', 'upgraded_cluster'
|
||||
* <li>shut down the entire cluster
|
||||
* </ul>
|
||||
*
|
||||
* Be careful: gradle dry run spits out tasks in the wrong order but,
|
||||
* strangely, running the tasks works properly.
|
||||
*/
|
||||
String baseName = "v${version}"
|
||||
String baseName = "v${bwcVersion}"
|
||||
|
||||
Task oldClusterTest = tasks.create(name: "${baseName}#oldClusterTest", type: RestIntegTestTask) {
|
||||
mustRunAfter(precommit)
|
||||
}
|
||||
testClusters {
|
||||
"${baseName}" {
|
||||
versions = [ bwcVersion.toString(), project.version ]
|
||||
numberOfNodes = 3
|
||||
|
||||
configure(extensions.findByName("${baseName}#oldClusterTestCluster")) {
|
||||
bwcVersion = version
|
||||
numBwcNodes = 3
|
||||
numNodes = 3
|
||||
clusterName = 'rolling-upgrade'
|
||||
setting 'repositories.url.allowed_urls', 'http://snapshot.test*'
|
||||
if (version.onOrAfter('5.3.0')) {
|
||||
setting 'http.content_type.required', 'true'
|
||||
}
|
||||
}
|
||||
|
||||
Task oldClusterTestRunner = tasks.getByName("${baseName}#oldClusterTestRunner")
|
||||
oldClusterTestRunner.configure {
|
||||
systemProperty 'tests.rest.suite', 'old_cluster'
|
||||
systemProperty 'tests.upgrade_from_version', version.toString().replace('-SNAPSHOT', '')
|
||||
}
|
||||
|
||||
Closure configureUpgradeCluster = {String name, Task lastRunner, int stopNode, Closure getOtherUnicastHostAddresses ->
|
||||
configure(extensions.findByName("${baseName}#${name}")) {
|
||||
dependsOn lastRunner, "${baseName}#oldClusterTestCluster#node${stopNode}.stop"
|
||||
clusterName = 'rolling-upgrade'
|
||||
otherUnicastHostAddresses = { getOtherUnicastHostAddresses() }
|
||||
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 }
|
||||
setting 'repositories.url.allowed_urls', 'http://snapshot.test*'
|
||||
setting 'node.name', "upgraded-node-${stopNode}"
|
||||
setting 'path.repo', "${buildDir}/cluster/shared/repo/${baseName}"
|
||||
setting 'http.content_type.required', 'true'
|
||||
javaHome = project.file(project.ext.runtimeJavaHome)
|
||||
}
|
||||
}
|
||||
|
||||
Task oneThirdUpgradedTest = tasks.create(name: "${baseName}#oneThirdUpgradedTest", type: RestIntegTestTask)
|
||||
tasks.register("${baseName}#oldClusterTest", RestTestRunnerTask) {
|
||||
dependsOn processTestResources
|
||||
useCluster testClusters."${baseName}"
|
||||
mustRunAfter(precommit)
|
||||
doFirst {
|
||||
project.delete("${buildDir}/cluster/shared/repo/${baseName}")
|
||||
}
|
||||
systemProperty 'tests.rest.suite', 'old_cluster'
|
||||
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",") }")
|
||||
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName() }")
|
||||
}
|
||||
|
||||
configureUpgradeCluster("oneThirdUpgradedTestCluster", oldClusterTestRunner, 0,
|
||||
// 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()] })
|
||||
|
||||
Task oneThirdUpgradedTestRunner = tasks.getByName("${baseName}#oneThirdUpgradedTestRunner")
|
||||
oneThirdUpgradedTestRunner.configure {
|
||||
tasks.register("${baseName}#oneThirdUpgradedTest", RestTestRunnerTask) {
|
||||
dependsOn "${baseName}#oldClusterTest"
|
||||
useCluster testClusters."${baseName}"
|
||||
doFirst {
|
||||
testClusters."${baseName}".nextNodeToNextVersion()
|
||||
}
|
||||
systemProperty 'tests.rest.suite', 'mixed_cluster'
|
||||
systemProperty 'tests.upgrade_from_version', version.toString()
|
||||
systemProperty 'tests.upgrade_from_version', project.version.replace("-SNAPSHOT", "")
|
||||
systemProperty 'tests.first_round', 'true'
|
||||
finalizedBy "${baseName}#oldClusterTestCluster#node1.stop"
|
||||
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",") }")
|
||||
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName() }")
|
||||
}
|
||||
|
||||
Task twoThirdsUpgradedTest = tasks.create(name: "${baseName}#twoThirdsUpgradedTest", type: RestIntegTestTask)
|
||||
|
||||
configureUpgradeCluster("twoThirdsUpgradedTestCluster", oneThirdUpgradedTestRunner, 1,
|
||||
// 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()] })
|
||||
|
||||
Task twoThirdsUpgradedTestRunner = tasks.getByName("${baseName}#twoThirdsUpgradedTestRunner")
|
||||
twoThirdsUpgradedTestRunner.configure {
|
||||
tasks.register("${baseName}#twoThirdsUpgradedTest", RestTestRunnerTask) {
|
||||
dependsOn "${baseName}#oneThirdUpgradedTest"
|
||||
useCluster testClusters."${baseName}"
|
||||
doFirst {
|
||||
testClusters."${baseName}".nextNodeToNextVersion()
|
||||
}
|
||||
systemProperty 'tests.rest.suite', 'mixed_cluster'
|
||||
systemProperty 'tests.upgrade_from_version', version.toString()
|
||||
systemProperty 'tests.upgrade_from_version', project.version.replace("-SNAPSHOT", "")
|
||||
systemProperty 'tests.first_round', 'false'
|
||||
finalizedBy "${baseName}#oldClusterTestCluster#node2.stop"
|
||||
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",") }")
|
||||
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName() }")
|
||||
}
|
||||
|
||||
Task upgradedClusterTest = tasks.create(name: "${baseName}#upgradedClusterTest", type: RestIntegTestTask)
|
||||
|
||||
configureUpgradeCluster("upgradedClusterTestCluster", twoThirdsUpgradedTestRunner, 2,
|
||||
// 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()] })
|
||||
|
||||
Task upgradedClusterTestRunner = tasks.getByName("${baseName}#upgradedClusterTestRunner")
|
||||
upgradedClusterTestRunner.configure {
|
||||
tasks.register("${baseName}#upgradedClusterTest", RestTestRunnerTask) {
|
||||
dependsOn "${baseName}#twoThirdsUpgradedTest"
|
||||
doFirst {
|
||||
testClusters."${baseName}".nextNodeToNextVersion()
|
||||
}
|
||||
useCluster testClusters."${baseName}"
|
||||
systemProperty 'tests.rest.suite', 'upgraded_cluster'
|
||||
systemProperty 'tests.upgrade_from_version', version.toString()
|
||||
/*
|
||||
* 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"
|
||||
}
|
||||
|
||||
Task versionBwcTest = tasks.create(name: "${baseName}#bwcTest") {
|
||||
enabled = project.bwc_tests_enabled
|
||||
dependsOn = [upgradedClusterTest]
|
||||
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",") }")
|
||||
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName() }")
|
||||
}
|
||||
|
||||
if (project.bwc_tests_enabled) {
|
||||
bwcTest.dependsOn(versionBwcTest)
|
||||
bwcTest.dependsOn(
|
||||
tasks.register("${baseName}#bwcTest") {
|
||||
dependsOn tasks.named("${baseName}#upgradedClusterTest")
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,3 +144,5 @@ task bwcTestSnapshots {
|
|||
}
|
||||
|
||||
check.dependsOn(bwcTestSnapshots)
|
||||
|
||||
test.enabled = false
|
||||
|
|
|
@ -69,6 +69,8 @@ import static org.hamcrest.Matchers.nullValue;
|
|||
*/
|
||||
public class RecoveryIT extends AbstractRollingTestCase {
|
||||
|
||||
private static String CLUSTER_NAME = System.getProperty("tests.clustername");
|
||||
|
||||
public void testHistoryUUIDIsGenerated() throws Exception {
|
||||
final String index = "index_history_uuid";
|
||||
if (CLUSTER_TYPE == ClusterType.OLD) {
|
||||
|
@ -303,54 +305,6 @@ public class RecoveryIT extends AbstractRollingTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This test ensures that peer recovery won't get stuck in a situation where the recovery target and recovery source
|
||||
* have an identical sync id but different local checkpoint in the commit in particular the target does not have
|
||||
* sequence numbers yet. This is possible if the primary is on 6.x while the replica was on 5.x and some write
|
||||
* operations with sequence numbers have taken place. If this is not the case, then peer recovery should utilize
|
||||
* syncId and skip copying files.
|
||||
*/
|
||||
public void testRecoverSyncedFlushIndex() throws Exception {
|
||||
final String index = "recover_synced_flush_index";
|
||||
if (CLUSTER_TYPE == ClusterType.OLD) {
|
||||
Settings.Builder settings = Settings.builder()
|
||||
.put(IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1)
|
||||
.put(IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 2);
|
||||
if (randomBoolean()) {
|
||||
settings.put(IndexSettings.INDEX_TRANSLOG_RETENTION_AGE_SETTING.getKey(), "-1")
|
||||
.put(IndexSettings.INDEX_TRANSLOG_RETENTION_SIZE_SETTING.getKey(), "-1")
|
||||
.put(IndexSettings.INDEX_TRANSLOG_GENERATION_THRESHOLD_SIZE_SETTING.getKey(), "256b");
|
||||
}
|
||||
createIndex(index, settings.build());
|
||||
ensureGreen(index);
|
||||
indexDocs(index, 0, 40);
|
||||
syncedFlush(index);
|
||||
} else if (CLUSTER_TYPE == ClusterType.MIXED) {
|
||||
ensureGreen(index);
|
||||
if (firstMixedRound) {
|
||||
assertPeerRecoveredFiles("peer recovery with syncId should not copy files", index, "upgraded-node-0", equalTo(0));
|
||||
assertDocCountOnAllCopies(index, 40);
|
||||
indexDocs(index, 40, 50);
|
||||
syncedFlush(index);
|
||||
} else {
|
||||
assertPeerRecoveredFiles("peer recovery with syncId should not copy files", index, "upgraded-node-1", equalTo(0));
|
||||
assertDocCountOnAllCopies(index, 90);
|
||||
indexDocs(index, 90, 60);
|
||||
syncedFlush(index);
|
||||
// exclude node-2 from allocation-filter so we can trim translog on the primary before node-2 starts recover
|
||||
if (randomBoolean()) {
|
||||
updateIndexSettings(index, Settings.builder().put("index.routing.allocation.include._name", "upgraded-*"));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
final int docsAfterUpgraded = randomIntBetween(0, 100);
|
||||
indexDocs(index, 150, docsAfterUpgraded);
|
||||
ensureGreen(index);
|
||||
assertPeerRecoveredFiles("peer recovery with syncId should not copy files", index, "upgraded-node-2", equalTo(0));
|
||||
assertDocCountOnAllCopies(index, 150 + docsAfterUpgraded);
|
||||
}
|
||||
}
|
||||
|
||||
public void testRecoveryWithSoftDeletes() throws Exception {
|
||||
final String index = "recover_with_soft_deletes";
|
||||
if (CLUSTER_TYPE == ClusterType.OLD) {
|
||||
|
@ -538,12 +492,15 @@ public class RecoveryIT extends AbstractRollingTestCase {
|
|||
.put(IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 1)
|
||||
.put(EnableAllocationDecider.INDEX_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), "none")
|
||||
.put(INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), "120s")
|
||||
.put("index.routing.allocation.include._name", "node-0")
|
||||
.put("index.routing.allocation.include._name", CLUSTER_NAME + "-0")
|
||||
.build());
|
||||
indexDocs(indexName, 0, randomInt(10));
|
||||
// allocate replica to node-2
|
||||
updateIndexSettings(indexName,
|
||||
Settings.builder().put("index.routing.allocation.include._name", "node-0,node-2,upgraded-node-*"));
|
||||
Settings.builder().put(
|
||||
"index.routing.allocation.include._name",
|
||||
CLUSTER_NAME + "-0," + CLUSTER_NAME + "-2," + CLUSTER_NAME + "-*")
|
||||
);
|
||||
ensureGreen(indexName);
|
||||
closeIndex(indexName);
|
||||
}
|
||||
|
@ -554,8 +511,16 @@ public class RecoveryIT extends AbstractRollingTestCase {
|
|||
// so we expect the index to be closed and replicated
|
||||
ensureGreen(indexName);
|
||||
assertClosedIndex(indexName, true);
|
||||
if (CLUSTER_TYPE != ClusterType.OLD && minimumNodeVersion().onOrAfter(Version.V_7_2_0)) {
|
||||
assertNoFileBasedRecovery(indexName, s-> s.startsWith("upgraded"));
|
||||
if (minimumNodeVersion().onOrAfter(Version.V_7_2_0)) {
|
||||
switch (CLUSTER_TYPE) {
|
||||
case OLD: break;
|
||||
case MIXED:
|
||||
assertNoFileBasedRecovery(indexName, s -> s.startsWith(CLUSTER_NAME + "-0"));
|
||||
break;
|
||||
case UPGRADED:
|
||||
assertNoFileBasedRecovery(indexName, s -> s.startsWith(CLUSTER_NAME));
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
assertClosedIndex(indexName, false);
|
||||
|
|
|
@ -19,45 +19,45 @@
|
|||
|
||||
import org.elasticsearch.gradle.Version
|
||||
import org.elasticsearch.gradle.VersionProperties
|
||||
import org.elasticsearch.gradle.test.RestIntegTestTask
|
||||
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask
|
||||
|
||||
apply plugin: 'elasticsearch.testclusters'
|
||||
apply plugin: 'elasticsearch.standalone-test'
|
||||
|
||||
// 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 {
|
||||
tasks.register("bwcTest") {
|
||||
description = 'Runs backwards compatibility tests.'
|
||||
group = 'verification'
|
||||
}
|
||||
|
||||
for (Version version : bwcVersions.indexCompatible) {
|
||||
String baseName = "v${version}"
|
||||
Task oldClusterTest = tasks.create(name: "${baseName}#oldClusterTest", type: RestIntegTestTask) {
|
||||
mustRunAfter(precommit)
|
||||
}
|
||||
configure(extensions.findByName("${baseName}#oldClusterTestCluster")) {
|
||||
bwcVersion = version
|
||||
numBwcNodes = 1
|
||||
numNodes = 1
|
||||
clusterName = 'verify-version-constants'
|
||||
if (version.onOrAfter('5.3.0')) {
|
||||
for (Version bwcVersion : bwcVersions.indexCompatible) {
|
||||
String baseName = "v${bwcVersion}"
|
||||
|
||||
testClusters {
|
||||
"${baseName}" {
|
||||
version = bwcVersion.toString()
|
||||
setting 'http.content_type.required', 'true'
|
||||
javaHome = project.file(project.ext.runtimeJavaHome)
|
||||
}
|
||||
}
|
||||
|
||||
Task versionBwcTest = tasks.create(name: "${baseName}#bwcTest") {
|
||||
dependsOn = [oldClusterTest]
|
||||
tasks.register("${baseName}#integTest", RestTestRunnerTask) {
|
||||
useCluster testClusters."${baseName}"
|
||||
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",") }")
|
||||
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName() }")
|
||||
}
|
||||
|
||||
bwcTest.dependsOn(versionBwcTest)
|
||||
}
|
||||
tasks.register("${baseName}#bwcTest") {
|
||||
dependsOn "${baseName}#integTest"
|
||||
}
|
||||
|
||||
test.enabled = false
|
||||
bwcTest.dependsOn("${baseName}#bwcTest")
|
||||
}
|
||||
|
||||
task bwcTestSnapshots {
|
||||
if (project.bwc_tests_enabled) {
|
||||
final def version = bwcVersions.unreleasedIndexCompatible.first()
|
||||
dependsOn "v${version}#bwcTest"
|
||||
for (version in bwcVersions.unreleasedIndexCompatible) {
|
||||
dependsOn "v${version}#bwcTest"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -84,3 +84,5 @@ task verifyDocsLuceneVersion {
|
|||
}
|
||||
|
||||
check.dependsOn bwcTestSnapshots, verifyDocsLuceneVersion
|
||||
|
||||
test.enabled = false
|
|
@ -34,7 +34,7 @@
|
|||
(\d+ \s+)? #no value from client nodes
|
||||
[-\w.]+ \s+
|
||||
\d+(\.\d+){3} \s+
|
||||
[-\w]+
|
||||
[-\w.]+
|
||||
\n
|
||||
)+
|
||||
$/
|
||||
|
@ -61,7 +61,7 @@
|
|||
(\d+ \s+) #always should return value since we filter out non data nodes by default
|
||||
[-\w.]+ \s+
|
||||
\d+(\.\d+){3} \s+
|
||||
[-\w]+
|
||||
[-\w.]+
|
||||
\n
|
||||
)+
|
||||
(
|
||||
|
@ -90,7 +90,7 @@
|
|||
(\d+ \s+)? #no value from client nodes
|
||||
[-\w.]+ \s+
|
||||
\d+(\.\d+){3} \s+
|
||||
[-\w]+
|
||||
[-\w.]+
|
||||
\n
|
||||
)
|
||||
$/
|
||||
|
@ -124,7 +124,7 @@
|
|||
(\d+ \s+)? #no value from client nodes
|
||||
[-\w.]+ \s+
|
||||
\d+(\.\d+){3} \s+
|
||||
[-\w]+
|
||||
[-\w.]+
|
||||
\n
|
||||
)+
|
||||
(
|
||||
|
@ -164,7 +164,7 @@
|
|||
(\d+ \s+) #always should return value since we filter out non data nodes by default
|
||||
[-\w.]+ \s+
|
||||
\d+(\.\d+){3} \s+
|
||||
[-\w]+
|
||||
[-\w.]+
|
||||
\n
|
||||
)+
|
||||
$/
|
||||
|
@ -181,7 +181,7 @@
|
|||
$body: |
|
||||
/^
|
||||
( \d* \s+
|
||||
[-\w]+
|
||||
[-\w.]+
|
||||
\n
|
||||
)+
|
||||
$/
|
||||
|
@ -199,7 +199,7 @@
|
|||
\n
|
||||
(
|
||||
\s+\d* \s+
|
||||
[-\w]+
|
||||
[-\w.]+
|
||||
\n
|
||||
)+
|
||||
$/
|
||||
|
@ -224,7 +224,7 @@
|
|||
(\d+ \s+) #always should return value since we filter out non data nodes by default
|
||||
[-\w.]+ \s+
|
||||
\d+(\.\d+){3} \s+
|
||||
[-\w]+
|
||||
[-\w.]+
|
||||
\n
|
||||
)+
|
||||
$/
|
||||
|
|
|
@ -868,17 +868,27 @@ public abstract class ESRestTestCase extends ESTestCase {
|
|||
* @param index index to test for
|
||||
**/
|
||||
protected static void ensureGreen(String index) throws IOException {
|
||||
Request request = new Request("GET", "/_cluster/health/" + index);
|
||||
request.addParameter("wait_for_status", "green");
|
||||
request.addParameter("wait_for_no_relocating_shards", "true");
|
||||
request.addParameter("timeout", "70s");
|
||||
request.addParameter("level", "shards");
|
||||
ensureHealth(index, (request) -> {
|
||||
request.addParameter("wait_for_status", "green");
|
||||
request.addParameter("wait_for_no_relocating_shards", "true");
|
||||
request.addParameter("timeout", "70s");
|
||||
request.addParameter("level", "shards");
|
||||
});
|
||||
}
|
||||
|
||||
protected static void ensureHealth(Consumer<Request> requestConsumer) throws IOException {
|
||||
ensureHealth("", requestConsumer);
|
||||
}
|
||||
|
||||
protected static void ensureHealth(String index, Consumer<Request> requestConsumer) throws IOException {
|
||||
Request request = new Request("GET", "/_cluster/health" + (index.trim().isEmpty() ? "" : "/" + index));
|
||||
requestConsumer.accept(request);
|
||||
try {
|
||||
client().performRequest(request);
|
||||
} catch (ResponseException e) {
|
||||
if (e.getResponse().getStatusLine().getStatusCode() == HttpStatus.SC_REQUEST_TIMEOUT) {
|
||||
try {
|
||||
final Response clusterStateResponse = client().performRequest(new Request("GET", "/_cluster/state"));
|
||||
final Response clusterStateResponse = client().performRequest(new Request("GET", "/_cluster/state?pretty"));
|
||||
fail("timed out waiting for green state for index [" + index + "] " +
|
||||
"cluster state [" + EntityUtils.toString(clusterStateResponse.getEntity()) + "]");
|
||||
} catch (Exception inner) {
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
import org.elasticsearch.gradle.test.NodeInfo
|
||||
import org.elasticsearch.gradle.test.RestIntegTestTask
|
||||
import org.elasticsearch.gradle.Version
|
||||
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask
|
||||
|
||||
import java.nio.charset.StandardCharsets
|
||||
|
||||
// Apply the java plugin to this project so the sources can be edited in an IDE
|
||||
apply plugin: 'elasticsearch.testclusters'
|
||||
apply plugin: 'elasticsearch.standalone-test'
|
||||
|
||||
test.enabled = false
|
||||
|
||||
dependencies {
|
||||
// TODO: Remove core dependency and change tests to not use builders that are part of xpack-core.
|
||||
// Currently needed for ml tests are using the building for datafeed and job config)
|
||||
|
@ -18,49 +14,6 @@ dependencies {
|
|||
testCompile project(':x-pack:qa')
|
||||
}
|
||||
|
||||
Closure waitWithAuth = { NodeInfo node, AntBuilder ant ->
|
||||
File tmpFile = new File(node.cwd, 'wait.success')
|
||||
|
||||
// wait up to twenty seconds
|
||||
final long stopTime = System.currentTimeMillis() + 20000L;
|
||||
Exception lastException = null;
|
||||
|
||||
while (System.currentTimeMillis() < stopTime) {
|
||||
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 {
|
||||
httpURLConnection = (HttpURLConnection) new URL("http://${node.httpUri()}/_cluster/health?wait_for_nodes=${node.config.numNodes}&wait_for_status=yellow").openConnection();
|
||||
httpURLConnection.setRequestProperty("Authorization", "Basic " +
|
||||
Base64.getEncoder().encodeToString("test_user:x-pack-test-password".getBytes(StandardCharsets.UTF_8)));
|
||||
httpURLConnection.setRequestMethod("GET");
|
||||
httpURLConnection.setConnectTimeout(1000);
|
||||
httpURLConnection.setReadTimeout(30000); // read needs to wait for nodes!
|
||||
httpURLConnection.connect();
|
||||
if (httpURLConnection.getResponseCode() == 200) {
|
||||
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);
|
||||
}
|
||||
if (tmpFile.exists() == false && lastException != null) {
|
||||
logger.error("final attempt of calling cluster health failed", lastException)
|
||||
}
|
||||
return tmpFile.exists()
|
||||
}
|
||||
|
||||
licenseHeaders {
|
||||
approvedLicenses << 'Apache'
|
||||
}
|
||||
|
@ -71,124 +24,114 @@ forbiddenPatterns {
|
|||
|
||||
String outputDir = "${buildDir}/generated-resources/${project.name}"
|
||||
|
||||
// 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 {
|
||||
tasks.register("bwcTest") {
|
||||
description = 'Runs backwards compatibility tests.'
|
||||
group = 'verification'
|
||||
}
|
||||
|
||||
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')
|
||||
tasks.register("copyTestNodeKeyMaterial", 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 version : bwcVersions.indexCompatible) {
|
||||
String baseName = "v${version}"
|
||||
configurations {
|
||||
restSpec
|
||||
}
|
||||
|
||||
Task oldClusterTest = tasks.create(name: "${baseName}#oldClusterTest", type: RestIntegTestTask) {
|
||||
mustRunAfter(precommit)
|
||||
dependencies {
|
||||
restSpec project(':rest-api-spec')
|
||||
}
|
||||
|
||||
processTestResources {
|
||||
dependsOn configurations.restSpec
|
||||
from ({ zipTree(configurations.restSpec.singleFile) }) {
|
||||
include 'rest-api-spec/api/**'
|
||||
}
|
||||
|
||||
Object extension = extensions.findByName("${baseName}#oldClusterTestCluster")
|
||||
configure(extensions.findByName("${baseName}#oldClusterTestCluster")) {
|
||||
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}"
|
||||
|
||||
}
|
||||
bwcVersion = version
|
||||
numBwcNodes = 2
|
||||
numNodes = 2
|
||||
clusterName = 'full-cluster-restart'
|
||||
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'
|
||||
waitCondition = waitWithAuth
|
||||
|
||||
// some tests rely on the translog not being flushed
|
||||
setting 'indices.memory.shard_inactive_time', '20m'
|
||||
|
||||
setting 'xpack.security.enabled', 'true'
|
||||
setting 'xpack.security.transport.ssl.enabled', 'true'
|
||||
|
||||
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'
|
||||
|
||||
setting 'xpack.license.self_generated.type', 'trial'
|
||||
dependsOn copyTestNodeKeyMaterial
|
||||
extraConfigFile 'testnode.pem', new File(outputDir + '/testnode.pem')
|
||||
extraConfigFile 'testnode.crt', new File(outputDir + '/testnode.crt')
|
||||
|
||||
keystoreFile 'xpack.watcher.encryption_key', "${project.projectDir}/src/test/resources/system_key"
|
||||
setting 'xpack.watcher.encrypt_sensitive_data', 'true'
|
||||
}
|
||||
|
||||
Task oldClusterTestRunner = tasks.getByName("${baseName}#oldClusterTestRunner")
|
||||
oldClusterTestRunner.configure {
|
||||
systemProperty 'tests.is_old_cluster', 'true'
|
||||
systemProperty 'tests.old_cluster_version', version.toString().minus("-SNAPSHOT")
|
||||
systemProperty 'tests.path.repo', new File(buildDir, "cluster/shared/repo")
|
||||
exclude 'org/elasticsearch/upgrades/FullClusterRestartIT.class'
|
||||
exclude 'org/elasticsearch/upgrades/FullClusterRestartSettingsUpgradeIT.class'
|
||||
exclude 'org/elasticsearch/upgrades/QueryBuilderBWCIT.class'
|
||||
}
|
||||
|
||||
Task upgradedClusterTest = tasks.create(name: "${baseName}#upgradedClusterTest", type: RestIntegTestTask)
|
||||
|
||||
configure(extensions.findByName("${baseName}#upgradedClusterTestCluster")) {
|
||||
dependsOn oldClusterTestRunner,
|
||||
"${baseName}#oldClusterTestCluster#node0.stop",
|
||||
"${baseName}#oldClusterTestCluster#node1.stop"
|
||||
numNodes = 2
|
||||
clusterName = 'full-cluster-restart'
|
||||
dataDir = { nodeNum -> oldClusterTest.nodes[nodeNum].dataDir }
|
||||
cleanShared = false // We want to keep snapshots made by the old cluster!
|
||||
setupCommand 'setupTestUser', 'bin/elasticsearch-users', 'useradd', 'test_user', '-p', 'x-pack-test-password', '-r', 'superuser'
|
||||
waitCondition = waitWithAuth
|
||||
|
||||
// some tests rely on the translog not being flushed
|
||||
setting 'indices.memory.shard_inactive_time', '20m'
|
||||
setting 'xpack.security.enabled', 'true'
|
||||
|
||||
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'
|
||||
|
||||
setting 'xpack.license.self_generated.type', 'trial'
|
||||
dependsOn copyTestNodeKeyMaterial
|
||||
extraConfigFile 'testnode.pem', new File(outputDir + '/testnode.pem')
|
||||
extraConfigFile 'testnode.crt', new File(outputDir + '/testnode.crt')
|
||||
|
||||
setting 'xpack.watcher.encrypt_sensitive_data', 'true'
|
||||
keystoreFile 'xpack.watcher.encryption_key', "${project.projectDir}/src/test/resources/system_key"
|
||||
}
|
||||
|
||||
Task upgradedClusterTestRunner = tasks.getByName("${baseName}#upgradedClusterTestRunner")
|
||||
upgradedClusterTestRunner.configure {
|
||||
systemProperty 'tests.is_old_cluster', 'false'
|
||||
systemProperty 'tests.old_cluster_version', version.toString().minus("-SNAPSHOT")
|
||||
systemProperty 'tests.path.repo', new File(buildDir, "cluster/shared/repo")
|
||||
exclude 'org/elasticsearch/upgrades/FullClusterRestartIT.class'
|
||||
exclude 'org/elasticsearch/upgrades/FullClusterRestartSettingsUpgradeIT.class'
|
||||
exclude 'org/elasticsearch/upgrades/QueryBuilderBWCIT.class'
|
||||
}
|
||||
|
||||
Task versionBwcTest = tasks.create(name: "${baseName}#bwcTest") {
|
||||
dependsOn = [upgradedClusterTest]
|
||||
}
|
||||
|
||||
if (project.bwc_tests_enabled) {
|
||||
bwcTest.dependsOn(versionBwcTest)
|
||||
from (project(xpackModule('core')).sourceSets.test.resources) {
|
||||
include 'rest-api-spec/api/**'
|
||||
}
|
||||
}
|
||||
|
||||
for (Version bwcVersion : bwcVersions.indexCompatible) {
|
||||
String baseName = "v${bwcVersion}"
|
||||
|
||||
testClusters {
|
||||
"${baseName}" {
|
||||
testDistribution = "DEFAULT"
|
||||
versions = [bwcVersion.toString(), project.version]
|
||||
numberOfNodes = 2
|
||||
setting 'path.repo', "${buildDir}/cluster/shared/repo/${baseName}"
|
||||
javaHome = project.file(project.ext.runtimeJavaHome)
|
||||
user username: "test_user", password: "x-pack-test-password"
|
||||
|
||||
setting 'path.repo', "${buildDir}/cluster/shared/repo/${baseName}"
|
||||
// some tests rely on the translog not being flushed
|
||||
setting 'indices.memory.shard_inactive_time', '20m'
|
||||
setting 'xpack.security.enabled', 'true'
|
||||
setting 'xpack.security.transport.ssl.enabled', 'true'
|
||||
setting 'xpack.license.self_generated.type', 'trial'
|
||||
|
||||
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'
|
||||
|
||||
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'
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register("${baseName}#oldClusterTest", RestTestRunnerTask) {
|
||||
mustRunAfter(precommit)
|
||||
useCluster testClusters."${baseName}"
|
||||
dependsOn copyTestNodeKeyMaterial
|
||||
doFirst {
|
||||
project.delete("${buildDir}/cluster/shared/repo/${baseName}")
|
||||
}
|
||||
systemProperty 'tests.is_old_cluster', 'true'
|
||||
systemProperty 'tests.old_cluster_version', version.toString().minus("-SNAPSHOT")
|
||||
exclude 'org/elasticsearch/upgrades/FullClusterRestartIT.class'
|
||||
exclude 'org/elasticsearch/upgrades/FullClusterRestartSettingsUpgradeIT.class'
|
||||
exclude 'org/elasticsearch/upgrades/QueryBuilderBWCIT.class'
|
||||
}
|
||||
|
||||
|
||||
tasks.register("${baseName}#upgradedClusterTest", RestTestRunnerTask) {
|
||||
mustRunAfter(precommit)
|
||||
useCluster testClusters."${baseName}"
|
||||
dependsOn "${baseName}#oldClusterTest"
|
||||
doFirst {
|
||||
testClusters."${baseName}".goToNextVersion()
|
||||
}
|
||||
systemProperty 'tests.is_old_cluster', 'false'
|
||||
systemProperty 'tests.old_cluster_version', version.toString().minus("-SNAPSHOT")
|
||||
exclude 'org/elasticsearch/upgrades/FullClusterRestartIT.class'
|
||||
exclude 'org/elasticsearch/upgrades/FullClusterRestartSettingsUpgradeIT.class'
|
||||
exclude 'org/elasticsearch/upgrades/QueryBuilderBWCIT.class'
|
||||
}
|
||||
|
||||
tasks.matching { it.name.startsWith(baseName) && it.name.endsWith("ClusterTest") }.configureEach {
|
||||
it.systemProperty 'tests.old_cluster_version', bwcVersion.toString().minus("-SNAPSHOT")
|
||||
it.systemProperty 'tests.path.repo', "${buildDir}/cluster/shared/repo/${baseName}"
|
||||
it.nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",") }")
|
||||
it.nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName() }")
|
||||
}
|
||||
|
||||
tasks.register("${baseName}#bwcTest") {
|
||||
dependsOn "${baseName}#upgradedClusterTest"
|
||||
}
|
||||
|
||||
if (project.bwc_tests_enabled) {
|
||||
bwcTest.dependsOn("${baseName}#bwcTest")
|
||||
}
|
||||
}
|
||||
|
||||
// basic integ tests includes testing bwc against the most recent version
|
||||
task bwcTestSnapshots {
|
||||
if (project.bwc_tests_enabled) {
|
||||
for (final def version : bwcVersions.unreleasedIndexCompatible) {
|
||||
|
@ -199,11 +142,4 @@ task bwcTestSnapshots {
|
|||
|
||||
check.dependsOn(bwcTestSnapshots)
|
||||
|
||||
// copy x-pack plugin info so it is on the classpath and security manager has the right permissions
|
||||
task copyXPackRestSpec(type: Copy) {
|
||||
dependsOn(project.configurations.restSpec, 'processTestResources')
|
||||
from project(xpackModule('core')).sourceSets.test.resources
|
||||
include 'rest-api-spec/api/**'
|
||||
into project.sourceSets.test.output.resourcesDir
|
||||
}
|
||||
project.sourceSets.test.output.dir(outputDir, builtBy: copyXPackRestSpec)
|
||||
test.enabled = false
|
||||
|
|
|
@ -1,128 +1,113 @@
|
|||
import org.elasticsearch.gradle.Version
|
||||
import org.elasticsearch.gradle.test.RestIntegTestTask
|
||||
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask
|
||||
|
||||
apply plugin: 'elasticsearch.testclusters'
|
||||
apply plugin: 'elasticsearch.standalone-test'
|
||||
|
||||
dependencies {
|
||||
testCompile project(':x-pack:qa')
|
||||
}
|
||||
|
||||
// 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 {
|
||||
tasks.register("bwcTest") {
|
||||
description = 'Runs backwards compatibility tests.'
|
||||
group = 'verification'
|
||||
}
|
||||
|
||||
String outputDir = "${buildDir}/generated-resources/${project.name}"
|
||||
configurations {
|
||||
restSpec
|
||||
}
|
||||
|
||||
for (Version version : bwcVersions.wireCompatible) {
|
||||
String baseName = "v${version}"
|
||||
dependencies {
|
||||
restSpec project(':rest-api-spec')
|
||||
}
|
||||
|
||||
Task oldClusterTest = tasks.create(name: "${baseName}#oldClusterTest", type: RestIntegTestTask) {
|
||||
mustRunAfter(precommit)
|
||||
processTestResources {
|
||||
dependsOn configurations.restSpec
|
||||
from ({ zipTree(configurations.restSpec.singleFile) }) {
|
||||
include 'rest-api-spec/api/**'
|
||||
}
|
||||
|
||||
configure(extensions.findByName("${baseName}#oldClusterTestCluster")) {
|
||||
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}"
|
||||
|
||||
}
|
||||
bwcVersion = version
|
||||
numBwcNodes = 3
|
||||
numNodes = 3
|
||||
clusterName = 'rolling-upgrade-basic'
|
||||
setting 'xpack.security.enabled', 'false'
|
||||
setting 'xpack.monitoring.enabled', 'false'
|
||||
setting 'xpack.ml.enabled', 'false'
|
||||
setting 'xpack.watcher.enabled', 'false'
|
||||
setting 'xpack.license.self_generated.type', 'basic'
|
||||
from (project(xpackProject('plugin').path).sourceSets.test.resources) {
|
||||
include 'rest-api-spec/api/**'
|
||||
}
|
||||
}
|
||||
|
||||
Task oldClusterTestRunner = tasks.getByName("${baseName}#oldClusterTestRunner")
|
||||
oldClusterTestRunner.configure {
|
||||
systemProperty 'tests.rest.suite', 'old_cluster'
|
||||
}
|
||||
|
||||
Closure configureUpgradeCluster = {String name, Task lastRunner, int stopNode, Closure getOtherUnicastHostAddresses ->
|
||||
configure(extensions.findByName("${baseName}#${name}")) {
|
||||
dependsOn lastRunner, "${baseName}#oldClusterTestCluster#node${stopNode}.stop"
|
||||
clusterName = 'rolling-upgrade-basic'
|
||||
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 }
|
||||
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 'xpack.security.enabled', 'false'
|
||||
setting 'xpack.monitoring.enabled', 'false'
|
||||
setting 'xpack.ml.enabled', 'false'
|
||||
setting 'xpack.watcher.enabled', 'false'
|
||||
setting 'xpack.license.self_generated.type', 'basic'
|
||||
setting 'node.name', "upgraded-node-${stopNode}"
|
||||
javaHome = project.file(project.ext.runtimeJavaHome)
|
||||
}
|
||||
}
|
||||
|
||||
Task oneThirdUpgradedTest = tasks.create(name: "${baseName}#oneThirdUpgradedTest", type: RestIntegTestTask)
|
||||
tasks.register("${baseName}#oldClusterTest", RestTestRunnerTask) {
|
||||
useCluster testClusters."${baseName}"
|
||||
mustRunAfter(precommit)
|
||||
systemProperty 'tests.rest.suite', 'old_cluster'
|
||||
systemProperty 'tests.upgrade_from_version', version.toString().replace('-SNAPSHOT', '')
|
||||
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",") }")
|
||||
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName() }")
|
||||
}
|
||||
|
||||
configureUpgradeCluster("oneThirdUpgradedTestCluster", oldClusterTestRunner, 0,
|
||||
// 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()] })
|
||||
|
||||
Task oneThirdUpgradedTestRunner = tasks.getByName("${baseName}#oneThirdUpgradedTestRunner")
|
||||
oneThirdUpgradedTestRunner.configure {
|
||||
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'
|
||||
finalizedBy "${baseName}#oldClusterTestCluster#node1.stop"
|
||||
systemProperty 'tests.upgrade_from_version', bwcVersion.toString().replace('-SNAPSHOT', '')
|
||||
}
|
||||
|
||||
Task twoThirdsUpgradedTest = tasks.create(name: "${baseName}#twoThirdsUpgradedTest", type: RestIntegTestTask)
|
||||
|
||||
configureUpgradeCluster("twoThirdsUpgradedTestCluster", oneThirdUpgradedTestRunner, 1,
|
||||
// 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()] })
|
||||
|
||||
Task twoThirdsUpgradedTestRunner = tasks.getByName("${baseName}#twoThirdsUpgradedTestRunner")
|
||||
twoThirdsUpgradedTestRunner.configure {
|
||||
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'
|
||||
finalizedBy "${baseName}#oldClusterTestCluster#node2.stop"
|
||||
systemProperty 'tests.upgrade_from_version', bwcVersion.toString().replace('-SNAPSHOT', '')
|
||||
}
|
||||
|
||||
Task upgradedClusterTest = tasks.create(name: "${baseName}#upgradedClusterTest", type: RestIntegTestTask)
|
||||
|
||||
configureUpgradeCluster("upgradedClusterTestCluster", twoThirdsUpgradedTestRunner, 2,
|
||||
// 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()] })
|
||||
|
||||
Task upgradedClusterTestRunner = tasks.getByName("${baseName}#upgradedClusterTestRunner")
|
||||
upgradedClusterTestRunner.configure {
|
||||
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'
|
||||
/*
|
||||
* 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"
|
||||
systemProperty 'tests.upgrade_from_version', bwcVersion.toString().replace('-SNAPSHOT', '')
|
||||
}
|
||||
|
||||
Task versionBwcTest = tasks.create(name: "${baseName}#bwcTest") {
|
||||
dependsOn = [upgradedClusterTest]
|
||||
tasks.register("${baseName}#bwcTest") {
|
||||
dependsOn "${baseName}#upgradedClusterTest"
|
||||
}
|
||||
|
||||
if (project.bwc_tests_enabled) {
|
||||
bwcTest.dependsOn(versionBwcTest)
|
||||
bwcTest.dependsOn("${baseName}#bwcTest")
|
||||
}
|
||||
}
|
||||
|
||||
test.enabled = false // no unit tests for rolling upgrades, only the rest integration test
|
||||
|
||||
// basic integ tests includes testing bwc against the most recent version
|
||||
task bwcTestSnapshots {
|
||||
if (project.bwc_tests_enabled) {
|
||||
for (final def version : bwcVersions.unreleasedWireCompatible) {
|
||||
|
@ -134,22 +119,4 @@ check.dependsOn(bwcTestSnapshots)
|
|||
|
||||
compileTestJava.options.compilerArgs << "-Xlint:-cast,-rawtypes,-unchecked"
|
||||
|
||||
// copy x-pack plugin info so it is on the classpath and security manager has the right permissions
|
||||
task copyXPackRestSpec(type: Copy) {
|
||||
dependsOn(project.configurations.restSpec, 'processTestResources')
|
||||
from project(xpackProject('plugin').path).sourceSets.test.resources
|
||||
include 'rest-api-spec/api/**'
|
||||
into project.sourceSets.test.output.resourcesDir
|
||||
}
|
||||
project.sourceSets.test.output.dir(outputDir, builtBy: copyXPackRestSpec)
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name "elastic"
|
||||
url "https://artifacts.elastic.co/maven"
|
||||
}
|
||||
maven {
|
||||
name "elastic-snapshots"
|
||||
url "https://snapshots.elastic.co/maven"
|
||||
}
|
||||
}
|
||||
test.enabled = false
|
|
@ -1,268 +1,135 @@
|
|||
import org.elasticsearch.gradle.Version
|
||||
import org.elasticsearch.gradle.test.RestIntegTestTask
|
||||
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask
|
||||
|
||||
apply plugin: 'elasticsearch.testclusters'
|
||||
apply plugin: 'elasticsearch.standalone-test'
|
||||
|
||||
dependencies {
|
||||
testCompile project(':x-pack:qa')
|
||||
}
|
||||
|
||||
// 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 {
|
||||
tasks.register("bwcTest") {
|
||||
description = 'Runs backwards compatibility tests.'
|
||||
group = 'verification'
|
||||
}
|
||||
|
||||
for (Version version : bwcVersions.wireCompatible) {
|
||||
String taskPrefix = "v${version}"
|
||||
configurations {
|
||||
restSpec
|
||||
}
|
||||
|
||||
// ============================================================================================
|
||||
// Create leader cluster
|
||||
// ============================================================================================
|
||||
dependencies {
|
||||
restSpec project(':rest-api-spec')
|
||||
}
|
||||
|
||||
RestIntegTestTask leaderClusterTest = tasks.create(name: "${taskPrefix}#leader#clusterTest", type: RestIntegTestTask) {
|
||||
mustRunAfter(precommit)
|
||||
processTestResources {
|
||||
dependsOn configurations.restSpec
|
||||
from ({ zipTree(configurations.restSpec.singleFile) }) {
|
||||
include 'rest-api-spec/api/**'
|
||||
}
|
||||
|
||||
configure(extensions.findByName("${taskPrefix}#leader#clusterTestCluster")) {
|
||||
bwcVersion = version
|
||||
numBwcNodes = 3
|
||||
numNodes = 3
|
||||
clusterName = 'leader'
|
||||
setting 'xpack.security.enabled', 'false'
|
||||
setting 'xpack.monitoring.enabled', 'false'
|
||||
setting 'xpack.ml.enabled', 'false'
|
||||
setting 'xpack.watcher.enabled', 'false'
|
||||
setting 'xpack.license.self_generated.type', 'trial'
|
||||
}
|
||||
|
||||
Task leaderClusterTestRunner = tasks.getByName("${taskPrefix}#leader#clusterTestRunner")
|
||||
leaderClusterTestRunner.configure {
|
||||
systemProperty 'tests.upgrade_from_version', version.toString().replace('-SNAPSHOT', '')
|
||||
systemProperty 'tests.rest.upgrade_state', 'none'
|
||||
systemProperty 'tests.rest.cluster_name', 'leader'
|
||||
|
||||
nonInputProperties.systemProperty 'tests.leader_host', "${-> leaderClusterTest.nodes.get(0).httpUri()}"
|
||||
nonInputProperties.systemProperty 'tests.leader_remote_cluster_seed', "${-> leaderClusterTest.nodes.get(0).transportUri()}"
|
||||
}
|
||||
|
||||
// ============================================================================================
|
||||
// Create follower cluster
|
||||
// ============================================================================================
|
||||
|
||||
RestIntegTestTask followerClusterTest = tasks.create(name: "${taskPrefix}#follower#clusterTest", type: RestIntegTestTask) {
|
||||
mustRunAfter(precommit)
|
||||
}
|
||||
|
||||
configure(extensions.findByName("${taskPrefix}#follower#clusterTestCluster")) {
|
||||
dependsOn leaderClusterTestRunner
|
||||
bwcVersion = version
|
||||
numBwcNodes = 3
|
||||
numNodes = 3
|
||||
clusterName = 'follower'
|
||||
setting 'xpack.security.enabled', 'false'
|
||||
setting 'xpack.monitoring.enabled', 'false'
|
||||
setting 'xpack.ml.enabled', 'false'
|
||||
setting 'xpack.watcher.enabled', 'false'
|
||||
setting 'xpack.license.self_generated.type', 'trial'
|
||||
}
|
||||
|
||||
Task followerClusterTestRunner = tasks.getByName("${taskPrefix}#follower#clusterTestRunner")
|
||||
followerClusterTestRunner.configure {
|
||||
systemProperty 'tests.upgrade_from_version', version.toString().replace('-SNAPSHOT', '')
|
||||
systemProperty 'tests.rest.upgrade_state', 'none'
|
||||
systemProperty 'tests.rest.cluster_name', 'follower'
|
||||
|
||||
nonInputProperties.systemProperty 'tests.leader_host', "${-> leaderClusterTest.nodes.get(0).httpUri()}"
|
||||
nonInputProperties.systemProperty 'tests.leader_remote_cluster_seed', "${-> leaderClusterTest.nodes.get(0).transportUri()}"
|
||||
|
||||
nonInputProperties.systemProperty 'tests.follower_host', "${-> followerClusterTest.nodes.get(0).httpUri()}"
|
||||
nonInputProperties.systemProperty 'tests.follower_remote_cluster_seed', "${-> followerClusterTest.nodes.get(0).transportUri()}"
|
||||
}
|
||||
|
||||
// ============================================================================================
|
||||
// Upgrade follower cluster
|
||||
// ============================================================================================
|
||||
|
||||
Closure configureUpgradeCluster = {String prefix, String cluster, String name, Task lastRunner, int stopNode,
|
||||
RestIntegTestTask clusterTest, Closure getOtherUnicastHostAddresses ->
|
||||
configure(extensions.findByName("${prefix}#${cluster}#${name}")) {
|
||||
dependsOn lastRunner, "${prefix}#${cluster}#clusterTestCluster#node${stopNode}.stop"
|
||||
clusterName = cluster
|
||||
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 -> clusterTest.nodes[stopNode].dataDir }
|
||||
setting 'repositories.url.allowed_urls', 'http://snapshot.test*'
|
||||
setting 'xpack.security.enabled', 'false'
|
||||
setting 'xpack.monitoring.enabled', 'false'
|
||||
setting 'xpack.ml.enabled', 'false'
|
||||
setting 'xpack.watcher.enabled', 'false'
|
||||
setting 'xpack.license.self_generated.type', 'trial'
|
||||
setting 'node.name', "upgraded-node-${cluster}-${stopNode}"
|
||||
setting 'node.attr.upgraded', 'true'
|
||||
}
|
||||
}
|
||||
|
||||
Task followerOneThirdUpgradedTest = tasks.create(name: "${taskPrefix}#follower#oneThirdUpgradedTest", type: RestIntegTestTask)
|
||||
|
||||
configureUpgradeCluster(taskPrefix, 'follower', 'oneThirdUpgradedTestCluster', followerClusterTestRunner, 0, followerClusterTest,
|
||||
// Use all running nodes as seed nodes so there is no race between pinging and the tests
|
||||
{ [followerClusterTest.nodes.get(1).transportUri(), followerClusterTest.nodes.get(2).transportUri()] })
|
||||
|
||||
Task followerOneThirdUpgradedTestRunner = tasks.getByName("${taskPrefix}#follower#oneThirdUpgradedTestRunner")
|
||||
followerOneThirdUpgradedTestRunner.configure {
|
||||
systemProperty 'tests.upgrade_from_version', version.toString().replace('-SNAPSHOT', '')
|
||||
systemProperty 'tests.rest.upgrade_state', 'one_third'
|
||||
systemProperty 'tests.rest.cluster_name', 'follower'
|
||||
|
||||
nonInputProperties.systemProperty 'tests.follower_host', "${-> followerClusterTest.nodes.get(1).httpUri()}"
|
||||
nonInputProperties.systemProperty 'tests.follower_remote_cluster_seed', "${-> followerClusterTest.nodes.get(1).transportUri()}"
|
||||
|
||||
nonInputProperties.systemProperty 'tests.leader_host', "${-> leaderClusterTest.nodes.get(0).httpUri()}"
|
||||
nonInputProperties.systemProperty 'tests.leader_remote_cluster_seed', "${-> leaderClusterTest.nodes.get(0).transportUri()}"
|
||||
|
||||
finalizedBy "${taskPrefix}#follower#clusterTestCluster#node1.stop"
|
||||
}
|
||||
|
||||
Task followerTwoThirdsUpgradedTest = tasks.create(name: "${taskPrefix}#follower#twoThirdsUpgradedTest", type: RestIntegTestTask)
|
||||
|
||||
configureUpgradeCluster(taskPrefix, 'follower', 'twoThirdsUpgradedTestCluster', followerOneThirdUpgradedTestRunner, 1, followerClusterTest,
|
||||
// Use all running nodes as seed nodes so there is no race between pinging and the tests
|
||||
{ [followerClusterTest.nodes.get(2).transportUri(), followerOneThirdUpgradedTest.nodes.get(0).transportUri()] })
|
||||
|
||||
Task followerTwoThirdsUpgradedTestRunner = tasks.getByName("${taskPrefix}#follower#twoThirdsUpgradedTestRunner")
|
||||
followerTwoThirdsUpgradedTestRunner.configure {
|
||||
systemProperty 'tests.upgrade_from_version', version.toString().replace('-SNAPSHOT', '')
|
||||
systemProperty 'tests.rest.upgrade_state', 'two_third'
|
||||
systemProperty 'tests.rest.cluster_name', 'follower'
|
||||
|
||||
nonInputProperties.systemProperty 'tests.follower_host', "${-> followerClusterTest.nodes.get(2).httpUri()}"
|
||||
nonInputProperties.systemProperty 'tests.follower_remote_cluster_seed', "${-> followerClusterTest.nodes.get(2).transportUri()}"
|
||||
|
||||
nonInputProperties.systemProperty 'tests.leader_host', "${-> leaderClusterTest.nodes.get(0).httpUri()}"
|
||||
nonInputProperties.systemProperty 'tests.leader_remote_cluster_seed', "${-> leaderClusterTest.nodes.get(0).transportUri()}"
|
||||
|
||||
finalizedBy "${taskPrefix}#follower#clusterTestCluster#node2.stop"
|
||||
}
|
||||
|
||||
Task followerUpgradedClusterTest = tasks.create(name: "${taskPrefix}#follower#upgradedClusterTest", type: RestIntegTestTask)
|
||||
|
||||
configureUpgradeCluster(taskPrefix, 'follower', 'upgradedClusterTestCluster', followerTwoThirdsUpgradedTestRunner, 2, followerClusterTest,
|
||||
// Use all running nodes as seed nodes so there is no race between pinging and the tests
|
||||
{ [followerOneThirdUpgradedTest.nodes.get(0).transportUri(), followerTwoThirdsUpgradedTest.nodes.get(0).transportUri()] })
|
||||
|
||||
Task followerUpgradedClusterTestRunner = tasks.getByName("${taskPrefix}#follower#upgradedClusterTestRunner")
|
||||
followerUpgradedClusterTestRunner.configure {
|
||||
systemProperty 'tests.upgrade_from_version', version.toString().replace('-SNAPSHOT', '')
|
||||
systemProperty 'tests.rest.upgrade_state', 'all'
|
||||
systemProperty 'tests.rest.cluster_name', 'follower'
|
||||
|
||||
nonInputProperties.systemProperty 'tests.follower_host', "${-> followerOneThirdUpgradedTest.nodes.get(0).httpUri()}"
|
||||
nonInputProperties.systemProperty 'tests.follower_remote_cluster_seed', "${-> followerOneThirdUpgradedTest.nodes.get(0).transportUri()}"
|
||||
|
||||
nonInputProperties.systemProperty 'tests.leader_host', "${-> leaderClusterTest.nodes.get(0).httpUri()}"
|
||||
nonInputProperties.systemProperty 'tests.leader_remote_cluster_seed', "${-> leaderClusterTest.nodes.get(0).transportUri()}"
|
||||
|
||||
// This is needed, otherwise leader node 0 will stop after the leaderClusterTestRunner task has run.
|
||||
// Here it is ok to stop, because in the next task, the leader node 0 gets upgraded.
|
||||
finalizedBy "v${version}#leader#clusterTestCluster#node0.stop"
|
||||
}
|
||||
|
||||
// ============================================================================================
|
||||
// Upgrade leader cluster
|
||||
// ============================================================================================
|
||||
|
||||
Task leaderOneThirdUpgradedTest = tasks.create(name: "${taskPrefix}#leader#oneThirdUpgradedTest", type: RestIntegTestTask)
|
||||
|
||||
configureUpgradeCluster(taskPrefix, 'leader', 'oneThirdUpgradedTestCluster', followerUpgradedClusterTestRunner, 0, leaderClusterTest,
|
||||
// Use all running nodes as seed nodes so there is no race between pinging and the tests
|
||||
{ [leaderClusterTest.nodes.get(1).transportUri(), leaderClusterTest.nodes.get(2).transportUri()] })
|
||||
|
||||
Task leaderOneThirdUpgradedTestRunner = tasks.getByName("${taskPrefix}#leader#oneThirdUpgradedTestRunner")
|
||||
leaderOneThirdUpgradedTestRunner.configure {
|
||||
systemProperty 'tests.upgrade_from_version', version.toString().replace('-SNAPSHOT', '')
|
||||
systemProperty 'tests.rest.upgrade_state', 'one_third'
|
||||
systemProperty 'tests.rest.cluster_name', 'leader'
|
||||
|
||||
nonInputProperties.systemProperty 'tests.follower_host', "${-> followerUpgradedClusterTest.nodes.get(0).httpUri()}"
|
||||
nonInputProperties.systemProperty 'tests.follower_remote_cluster_seed', "${-> followerUpgradedClusterTest.nodes.get(0).transportUri()}"
|
||||
|
||||
nonInputProperties.systemProperty 'tests.leader_host', "${-> leaderClusterTest.nodes.get(2).httpUri()}"
|
||||
nonInputProperties.systemProperty 'tests.leader_remote_cluster_seed', "${-> leaderClusterTest.nodes.get(2).transportUri()}"
|
||||
|
||||
finalizedBy "${taskPrefix}#leader#clusterTestCluster#node1.stop"
|
||||
}
|
||||
|
||||
Task leaderTwoThirdsUpgradedTest = tasks.create(name: "${taskPrefix}#leader#twoThirdsUpgradedTest", type: RestIntegTestTask)
|
||||
|
||||
configureUpgradeCluster(taskPrefix, 'leader', 'twoThirdsUpgradedTestCluster', leaderOneThirdUpgradedTestRunner, 1, leaderClusterTest,
|
||||
// Use all running nodes as seed nodes so there is no race between pinging and the tests
|
||||
{ [leaderClusterTest.nodes.get(2).transportUri(), leaderOneThirdUpgradedTest.nodes.get(0).transportUri()] })
|
||||
|
||||
Task leaderTwoThirdsUpgradedTestRunner = tasks.getByName("${taskPrefix}#leader#twoThirdsUpgradedTestRunner")
|
||||
leaderTwoThirdsUpgradedTestRunner.configure {
|
||||
systemProperty 'tests.upgrade_from_version', version.toString().replace('-SNAPSHOT', '')
|
||||
systemProperty 'tests.rest.upgrade_state', 'two_third'
|
||||
systemProperty 'tests.rest.cluster_name', 'leader'
|
||||
|
||||
nonInputProperties.systemProperty 'tests.follower_host', "${-> followerUpgradedClusterTest.nodes.get(0).httpUri()}"
|
||||
nonInputProperties.systemProperty 'tests.follower_remote_cluster_seed', "${-> followerUpgradedClusterTest.nodes.get(0).transportUri()}"
|
||||
|
||||
nonInputProperties.systemProperty 'tests.leader_host', "${-> leaderOneThirdUpgradedTest.nodes.get(0).httpUri()}"
|
||||
nonInputProperties.systemProperty 'tests.leader_remote_cluster_seed', "${-> leaderOneThirdUpgradedTest.nodes.get(0).transportUri()}"
|
||||
|
||||
finalizedBy "${taskPrefix}#leader#clusterTestCluster#node2.stop"
|
||||
}
|
||||
|
||||
Task leaderUpgradedClusterTest = tasks.create(name: "${taskPrefix}#leader#upgradedClusterTest", type: RestIntegTestTask)
|
||||
|
||||
configureUpgradeCluster(taskPrefix, 'leader', "upgradedClusterTestCluster", leaderTwoThirdsUpgradedTestRunner, 2, leaderClusterTest,
|
||||
// Use all running nodes as seed nodes so there is no race between pinging and the tests
|
||||
{ [leaderOneThirdUpgradedTest.nodes.get(0).transportUri(), leaderTwoThirdsUpgradedTest.nodes.get(0).transportUri()] })
|
||||
|
||||
Task leaderUpgradedClusterTestRunner = tasks.getByName("${taskPrefix}#leader#upgradedClusterTestRunner")
|
||||
leaderUpgradedClusterTestRunner.configure {
|
||||
systemProperty 'tests.upgrade_from_version', version.toString().replace('-SNAPSHOT', '')
|
||||
systemProperty 'tests.rest.upgrade_state', 'all'
|
||||
systemProperty 'tests.rest.cluster_name', 'leader'
|
||||
|
||||
nonInputProperties.systemProperty 'tests.follower_host', "${-> followerUpgradedClusterTest.nodes.get(0).httpUri()}"
|
||||
nonInputProperties.systemProperty 'tests.follower_remote_cluster_seed', "${-> followerUpgradedClusterTest.nodes.get(0).transportUri()}"
|
||||
|
||||
nonInputProperties.systemProperty 'tests.leader_host', "${-> leaderTwoThirdsUpgradedTest.nodes.get(0).httpUri()}"
|
||||
nonInputProperties.systemProperty 'tests.leader_remote_cluster_seed', "${-> leaderTwoThirdsUpgradedTest.nodes.get(0).transportUri()}"
|
||||
|
||||
/*
|
||||
* Force stopping all the upgraded nodes after the test runner
|
||||
* so they are alive during the test.
|
||||
*/
|
||||
finalizedBy "${taskPrefix}#follower#oneThirdUpgradedTestCluster#stop"
|
||||
finalizedBy "${taskPrefix}#follower#twoThirdsUpgradedTestCluster#stop"
|
||||
finalizedBy "${taskPrefix}#follower#upgradedClusterTestCluster#stop"
|
||||
finalizedBy "${taskPrefix}#leader#oneThirdUpgradedTestCluster#stop"
|
||||
finalizedBy "${taskPrefix}#leader#twoThirdsUpgradedTestCluster#stop"
|
||||
}
|
||||
|
||||
if (project.bwc_tests_enabled) {
|
||||
Task versionBwcTest = tasks.create(name: "${taskPrefix}#bwcTest") {
|
||||
dependsOn = [leaderUpgradedClusterTest]
|
||||
}
|
||||
bwcTest.dependsOn(versionBwcTest)
|
||||
from (project(xpackProject('plugin').path).sourceSets.test.resources) {
|
||||
include 'rest-api-spec/api/**'
|
||||
}
|
||||
}
|
||||
|
||||
test.enabled = false // no unit tests for rolling upgrades, only the rest integration test
|
||||
for (Version bwcVersion : bwcVersions.wireCompatible) {
|
||||
String baseName = "v${bwcVersion}"
|
||||
|
||||
// basic integ tests includes testing bwc against the most recent version
|
||||
task integTest {
|
||||
testClusters {
|
||||
"${baseName}-leader" {
|
||||
numberOfNodes = 3
|
||||
}
|
||||
"${baseName}-follower" {
|
||||
numberOfNodes = 3
|
||||
}
|
||||
}
|
||||
testClusters.matching{ it.name.startsWith(baseName)}.all {
|
||||
testDistribution = "DEFAULT"
|
||||
versions = [bwcVersion.toString(), project.version]
|
||||
|
||||
setting 'repositories.url.allowed_urls', 'http://snapshot.test*'
|
||||
setting 'xpack.security.enabled', 'false'
|
||||
setting 'xpack.monitoring.enabled', 'false'
|
||||
setting 'xpack.ml.enabled', 'false'
|
||||
setting 'xpack.watcher.enabled', 'false'
|
||||
setting 'xpack.license.self_generated.type', 'trial'
|
||||
|
||||
javaHome = project.file(project.ext.runtimeJavaHome)
|
||||
}
|
||||
|
||||
tasks.withType(RestTestRunnerTask).matching{it.name.startsWith(baseName)}.configureEach {
|
||||
useCluster testClusters."${baseName}-leader"
|
||||
useCluster testClusters."${baseName}-follower"
|
||||
systemProperty 'tests.upgrade_from_version', bwcVersion.toString().replace('-SNAPSHOT', '')
|
||||
|
||||
doFirst {
|
||||
if (name.endsWith("#clusterTest") == false ) {
|
||||
println "Upgrade node $it"
|
||||
testClusters."${baseName}-${kindExt}".nextNodeToNextVersion()
|
||||
}
|
||||
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}-${kindExt}".allHttpSocketURI.join(",") }")
|
||||
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}-${kindExt}".getName() }")
|
||||
nonInputProperties.systemProperty('tests.leader_host', "${-> testClusters."${baseName}-leader".allHttpSocketURI.last()}")
|
||||
nonInputProperties.systemProperty('tests.leader_remote_cluster_seed', "${-> testClusters."${baseName}-leader".allTransportPortURI.last()}")
|
||||
nonInputProperties.systemProperty('tests.follower_host', "${-> testClusters."${baseName}-follower".allHttpSocketURI.last()}")
|
||||
nonInputProperties.systemProperty('tests.follower_remote_cluster_seed', "${-> testClusters."${baseName}-follower".allTransportPortURI.last()}")
|
||||
}
|
||||
}
|
||||
|
||||
for (kind in ["follower", "leader"]) {
|
||||
// Attention!! Groovy trap: do not pass `kind` to a closure
|
||||
|
||||
tasks.register("${baseName}#${kind}#clusterTest", RestTestRunnerTask) {
|
||||
systemProperty 'tests.rest.upgrade_state', 'none'
|
||||
systemProperty 'tests.rest.cluster_name', kind
|
||||
ext.kindExt = kind
|
||||
}
|
||||
|
||||
tasks.register("${baseName}#${kind}#oneThirdUpgradedTest", RestTestRunnerTask) {
|
||||
systemProperty 'tests.rest.upgrade_state', 'one_third'
|
||||
systemProperty 'tests.rest.cluster_name', kind
|
||||
dependsOn "${baseName}#leader#clusterTest", "${baseName}#follower#clusterTest"
|
||||
ext.kindExt = kind
|
||||
}
|
||||
|
||||
tasks.register("${baseName}#${kind}#twoThirdsUpgradedTest", RestTestRunnerTask) {
|
||||
systemProperty 'tests.rest.upgrade_state', 'two_third'
|
||||
systemProperty 'tests.rest.cluster_name', kind
|
||||
dependsOn "${baseName}#${kind}#oneThirdUpgradedTest"
|
||||
ext.kindExt = kind
|
||||
}
|
||||
|
||||
tasks.register("${baseName}#${kind}#upgradedClusterTest", RestTestRunnerTask) {
|
||||
systemProperty 'tests.rest.upgrade_state', 'all'
|
||||
systemProperty 'tests.rest.cluster_name', kind
|
||||
dependsOn "${baseName}#${kind}#twoThirdsUpgradedTest"
|
||||
ext.kindExt = kind
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named("${baseName}#follower#clusterTest") {
|
||||
dependsOn "${baseName}#leader#clusterTest"
|
||||
}
|
||||
|
||||
tasks.named("${baseName}#leader#oneThirdUpgradedTest") {
|
||||
dependsOn "${baseName}#follower#upgradedClusterTest"
|
||||
}
|
||||
|
||||
tasks.register("${baseName}#bwcTest") {
|
||||
dependsOn "${baseName}#leader#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(integTest)
|
||||
check.dependsOn(bwcTestSnapshots)
|
||||
|
||||
test.enabled = false
|
|
@ -106,6 +106,7 @@ public abstract class AbstractMultiClusterUpgradeTestCase extends ESRestTestCase
|
|||
} else {
|
||||
throw new AssertionError("unknown cluster name: " + clusterName);
|
||||
}
|
||||
logger.info("Leader host: {}, follower host: {}", leaderHost, followerHost);
|
||||
|
||||
configureLeaderRemoteClusters();
|
||||
configureFollowerRemoteClusters();
|
||||
|
|
|
@ -133,6 +133,7 @@ public class CcrRollingUpgradeIT extends AbstractMultiClusterUpgradeTestCase {
|
|||
createLeaderIndex(leaderClient(), leaderIndex1);
|
||||
index(leaderClient(), leaderIndex1, 64);
|
||||
assertBusy(() -> {
|
||||
|
||||
String followerIndex = "copy-" + leaderIndex1;
|
||||
assertThat(getNumberOfSuccessfulFollowedIndices(), equalTo(1));
|
||||
assertTotalHitCount(followerIndex, 64, followerClient());
|
||||
|
@ -316,7 +317,8 @@ public class CcrRollingUpgradeIT extends AbstractMultiClusterUpgradeTestCase {
|
|||
|
||||
private static void putAutoFollowPattern(RestClient client, String name, String remoteCluster, String pattern) throws IOException {
|
||||
Request request = new Request("PUT", "/_ccr/auto_follow/" + name);
|
||||
request.setJsonEntity("{\"leader_index_patterns\": [\"" + pattern + "\"], \"remote_cluster\": \"" + remoteCluster + "\"," +
|
||||
request.setJsonEntity("{\"leader_index_patterns\": [\"" + pattern + "\"], \"remote_cluster\": \"" +
|
||||
remoteCluster + "\"," +
|
||||
"\"follow_index_pattern\": \"copy-{{leader_index}}\", \"read_poll_timeout\": \"10ms\"}");
|
||||
assertOK(client.performRequest(request));
|
||||
}
|
||||
|
@ -328,7 +330,7 @@ public class CcrRollingUpgradeIT extends AbstractMultiClusterUpgradeTestCase {
|
|||
|
||||
private int getNumberOfSuccessfulFollowedIndices() throws IOException {
|
||||
Request statsRequest = new Request("GET", "/_ccr/stats");
|
||||
Map<?, ?> response = toMap(client().performRequest(statsRequest));
|
||||
Map<?, ?> response = toMap(followerClient().performRequest(statsRequest));
|
||||
Integer actualSuccessfulFollowedIndices = ObjectPath.eval("auto_follow_stats.number_of_successful_follow_indices", response);
|
||||
if (actualSuccessfulFollowedIndices != null) {
|
||||
return actualSuccessfulFollowedIndices;
|
||||
|
|
|
@ -1,71 +1,14 @@
|
|||
import org.elasticsearch.gradle.test.NodeInfo
|
||||
import org.elasticsearch.gradle.test.RestIntegTestTask
|
||||
import org.elasticsearch.gradle.Version
|
||||
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask
|
||||
|
||||
import java.nio.charset.StandardCharsets
|
||||
|
||||
// Apply the java plugin to this project so the sources can be edited in an IDE
|
||||
apply plugin: 'elasticsearch.testclusters'
|
||||
apply plugin: 'elasticsearch.standalone-test'
|
||||
|
||||
test.enabled = false
|
||||
|
||||
dependencies {
|
||||
testCompile project(':x-pack:qa')
|
||||
testCompile project(':client:rest-high-level')
|
||||
}
|
||||
|
||||
Closure waitWithAuth = { NodeInfo node, AntBuilder ant ->
|
||||
File tmpFile = new File(node.cwd, 'wait.success')
|
||||
|
||||
// wait up to two minutes
|
||||
final long stopTime = System.currentTimeMillis() + (2 * 60000L);
|
||||
Exception lastException = null;
|
||||
int lastResponseCode = 0
|
||||
|
||||
while (System.currentTimeMillis() < stopTime) {
|
||||
|
||||
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
|
||||
httpURLConnection = (HttpURLConnection) new URL("http://${node.httpUri()}/_cluster/health?wait_for_nodes=3&wait_for_status=yellow").openConnection();
|
||||
httpURLConnection.setRequestProperty("Authorization", "Basic " +
|
||||
Base64.getEncoder().encodeToString("test_user:x-pack-test-password".getBytes(StandardCharsets.UTF_8)));
|
||||
httpURLConnection.setRequestMethod("GET");
|
||||
httpURLConnection.setConnectTimeout(1000);
|
||||
httpURLConnection.setReadTimeout(30000); // read needs to wait for nodes!
|
||||
httpURLConnection.connect();
|
||||
lastResponseCode = httpURLConnection.getResponseCode()
|
||||
if (lastResponseCode == 200) {
|
||||
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);
|
||||
}
|
||||
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]")
|
||||
}
|
||||
}
|
||||
return tmpFile.exists()
|
||||
}
|
||||
|
||||
compileTestJava.options.compilerArgs << "-Xlint:-cast,-rawtypes,-unchecked"
|
||||
|
||||
forbiddenPatterns {
|
||||
|
@ -74,119 +17,47 @@ forbiddenPatterns {
|
|||
|
||||
String outputDir = "${buildDir}/generated-resources/${project.name}"
|
||||
|
||||
// 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 {
|
||||
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 version : bwcVersions.wireCompatible) {
|
||||
String baseName = "v${version}"
|
||||
|
||||
for (Version bwcVersion : bwcVersions.wireCompatible) {
|
||||
String baseName = "v${bwcVersion}"
|
||||
|
||||
Task oldClusterTest = tasks.create(name: "${baseName}#oldClusterTest", type: RestIntegTestTask) {
|
||||
mustRunAfter(precommit)
|
||||
}
|
||||
testClusters {
|
||||
"${baseName}" {
|
||||
testDistribution = "DEFAULT"
|
||||
versions = [ bwcVersion.toString(), project.version ]
|
||||
numberOfNodes = 3
|
||||
|
||||
configure(extensions.findByName("${baseName}#oldClusterTestCluster")) {
|
||||
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}"
|
||||
}
|
||||
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
|
||||
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'
|
||||
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'
|
||||
keystoreSetting 'xpack.security.transport.ssl.secure_key_passphrase', 'testnode'
|
||||
|
||||
dependsOn copyTestNodeKeyMaterial
|
||||
extraConfigFile 'testnode.pem', new File(outputDir + '/testnode.pem')
|
||||
extraConfigFile 'testnode.crt', new File(outputDir + '/testnode.crt')
|
||||
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'
|
||||
}
|
||||
|
||||
// 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'
|
||||
systemProperty 'tests.upgrade_from_version', version.toString().replace('-SNAPSHOT', '')
|
||||
|
||||
def toBlackList = []
|
||||
// Dataframe transforms were not added until 7.2.0
|
||||
if (version.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 (version.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(',')
|
||||
}
|
||||
}
|
||||
|
||||
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 'repositories.url.allowed_urls', 'http://snapshot.test*'
|
||||
setting 'path.repo', "${buildDir}/cluster/shared/repo/${baseName}"
|
||||
setting 'http.content_type.required', 'true'
|
||||
setting 'xpack.monitoring.exporters._http.type', 'http'
|
||||
setting 'xpack.monitoring.exporters._http.enabled', 'false'
|
||||
setting 'xpack.monitoring.exporters._http.auth.username', 'test_user'
|
||||
|
@ -194,36 +65,82 @@ for (Version version : bwcVersions.wireCompatible) {
|
|||
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'
|
||||
keystoreSetting 'xpack.security.transport.ssl.secure_key_passphrase', 'testnode'
|
||||
|
||||
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.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'
|
||||
|
||||
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'
|
||||
keystoreFile 'xpack.watcher.encryption_key', "${project.projectDir}/src/test/resources/system_key"
|
||||
|
||||
// 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)
|
||||
}
|
||||
}
|
||||
|
||||
Task oneThirdUpgradedTest = tasks.create(name: "${baseName}#oneThirdUpgradedTest", type: RestIntegTestTask)
|
||||
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(',')
|
||||
}
|
||||
}
|
||||
|
||||
configureUpgradeCluster("oneThirdUpgradedTestCluster", oldClusterTestRunner, 0,
|
||||
// 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()] })
|
||||
|
||||
Task oneThirdUpgradedTestRunner = tasks.getByName("${baseName}#oneThirdUpgradedTestRunner")
|
||||
oneThirdUpgradedTestRunner.configure {
|
||||
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', version.toString().replace('-SNAPSHOT', '')
|
||||
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',
|
||||
|
@ -234,97 +151,75 @@ for (Version version : bwcVersions.wireCompatible) {
|
|||
'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 (version.before('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 (version.before('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(',')
|
||||
finalizedBy "${baseName}#oldClusterTestCluster#node1.stop"
|
||||
}
|
||||
|
||||
Task twoThirdsUpgradedTest = tasks.create(name: "${baseName}#twoThirdsUpgradedTest", type: RestIntegTestTask)
|
||||
|
||||
configureUpgradeCluster("twoThirdsUpgradedTestCluster", oneThirdUpgradedTestRunner, 1,
|
||||
// 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()] })
|
||||
|
||||
Task twoThirdsUpgradedTestRunner = tasks.getByName("${baseName}#twoThirdsUpgradedTestRunner")
|
||||
twoThirdsUpgradedTestRunner.configure {
|
||||
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'
|
||||
systemProperty 'tests.upgrade_from_version', version.toString().replace('-SNAPSHOT', '')
|
||||
finalizedBy "${baseName}#oldClusterTestCluster#node2.stop"
|
||||
def toBlackList = []
|
||||
// Dataframe transforms were not added until 7.2.0
|
||||
if (version.before('7.2.0')) {
|
||||
toBlackList << 'mixed_cluster/80_data_frame_jobs_crud/Test put batch data frame transforms on mixed cluster'
|
||||
toBlackList << 'mixed_cluster/80_data_frame_jobs_crud/Test GET, start, and stop old cluster batch transforms'
|
||||
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'
|
||||
])
|
||||
}
|
||||
// continuous Dataframe transforms were not added until 7.3.0
|
||||
if (version.before('7.3.0')) {
|
||||
toBlackList << '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', '')
|
||||
}
|
||||
|
||||
Task upgradedClusterTest = tasks.create(name: "${baseName}#upgradedClusterTest", type: RestIntegTestTask)
|
||||
tasks.register("${baseName}#upgradedClusterTest", RestTestRunnerTask) {
|
||||
dependsOn "${baseName}#twoThirdsUpgradedTest"
|
||||
useCluster testClusters."${baseName}"
|
||||
doFirst {
|
||||
testClusters."${baseName}".nextNodeToNextVersion()
|
||||
}
|
||||
|
||||
configureUpgradeCluster("upgradedClusterTestCluster", twoThirdsUpgradedTestRunner, 2,
|
||||
// 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()] })
|
||||
|
||||
Task upgradedClusterTestRunner = tasks.getByName("${baseName}#upgradedClusterTestRunner")
|
||||
upgradedClusterTestRunner.configure {
|
||||
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', version.toString().replace('-SNAPSHOT', '')
|
||||
/*
|
||||
* 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('\\.')
|
||||
systemProperty 'tests.upgrade_from_version', bwcVersion.toString().replace('-SNAPSHOT', '')
|
||||
def toBlackList = []
|
||||
if (versionParts[0].equals("5")) {
|
||||
Integer minor = Integer.parseInt(versionParts[1])
|
||||
if (minor >= 2) {
|
||||
toBlackList << '/20_security/Verify default password migration results in upgraded cluster'
|
||||
}
|
||||
}
|
||||
// Dataframe transforms were not added until 7.2.0
|
||||
if (version.before('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'
|
||||
}
|
||||
// continuous Dataframe transforms were not added until 7.3.0
|
||||
if (version.before('7.3.0')) {
|
||||
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(',')
|
||||
}
|
||||
}
|
||||
|
||||
Task versionBwcTest = tasks.create(name: "${baseName}#bwcTest") {
|
||||
dependsOn = [upgradedClusterTest]
|
||||
tasks.register("${baseName}#bwcTest") {
|
||||
dependsOn "${baseName}#upgradedClusterTest"
|
||||
}
|
||||
|
||||
if (project.bwc_tests_enabled) {
|
||||
bwcTest.dependsOn(versionBwcTest)
|
||||
bwcTest.dependsOn("${baseName}#bwcTest")
|
||||
}
|
||||
}
|
||||
|
||||
// basic integ tests includes testing bwc against the most recent version
|
||||
task bwcTestSnapshots {
|
||||
if (project.bwc_tests_enabled) {
|
||||
for (final def version : bwcVersions.unreleasedWireCompatible) {
|
||||
|
@ -334,11 +229,4 @@ task bwcTestSnapshots {
|
|||
}
|
||||
check.dependsOn(bwcTestSnapshots)
|
||||
|
||||
// copy x-pack plugin info so it is on the classpath and security manager has the right permissions
|
||||
task copyXPackRestSpec(type: Copy) {
|
||||
dependsOn(project.configurations.restSpec, 'processTestResources')
|
||||
from project(xpackProject('plugin').path).sourceSets.test.resources
|
||||
include 'rest-api-spec/api/**'
|
||||
into project.sourceSets.test.output.resourcesDir
|
||||
}
|
||||
project.sourceSets.test.output.dir(outputDir, builtBy: copyXPackRestSpec)
|
||||
test.enabled = false
|
|
@ -34,19 +34,19 @@ public class IndexingIT extends AbstractUpgradeTestCase {
|
|||
case OLD:
|
||||
break;
|
||||
case MIXED:
|
||||
Request waitForYellow = new Request("GET", "/_cluster/health");
|
||||
waitForYellow.addParameter("wait_for_nodes", "3");
|
||||
waitForYellow.addParameter("wait_for_status", "yellow");
|
||||
client().performRequest(waitForYellow);
|
||||
ensureHealth((request -> {
|
||||
request.addParameter("timeout", "70s");
|
||||
request.addParameter("wait_for_nodes", "3");
|
||||
request.addParameter("wait_for_status", "yellow");
|
||||
}));
|
||||
break;
|
||||
case UPGRADED:
|
||||
Request waitForGreen = new Request("GET", "/_cluster/health/test_index,index_with_replicas,empty_index");
|
||||
waitForGreen.addParameter("wait_for_nodes", "3");
|
||||
waitForGreen.addParameter("wait_for_status", "green");
|
||||
// wait for long enough that we give delayed unassigned shards to stop being delayed
|
||||
waitForGreen.addParameter("timeout", "70s");
|
||||
waitForGreen.addParameter("level", "shards");
|
||||
client().performRequest(waitForGreen);
|
||||
ensureHealth("test_index,index_with_replicas,empty_index", (request -> {
|
||||
request.addParameter("wait_for_nodes", "3");
|
||||
request.addParameter("wait_for_status", "green");
|
||||
request.addParameter("timeout", "70s");
|
||||
request.addParameter("level", "shards");
|
||||
}));
|
||||
break;
|
||||
default:
|
||||
throw new UnsupportedOperationException("Unknown cluster type [" + CLUSTER_TYPE + "]");
|
||||
|
|
|
@ -38,6 +38,7 @@ public class MlMappingsUpgradeIT extends AbstractUpgradeTestCase {
|
|||
* The purpose of this test is to ensure that when a job is open through a rolling upgrade we upgrade the results
|
||||
* index mappings when it is assigned to an upgraded node even if no other ML endpoint is called after the upgrade
|
||||
*/
|
||||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/46262")
|
||||
public void testMappingsUpgrade() throws Exception {
|
||||
|
||||
switch (CLUSTER_TYPE) {
|
||||
|
|
Loading…
Reference in New Issue