DISCOVERY: Fix RollingUpgradeTests (#35375)
* DISCOVERY: Fix RollingUpgradeTests * Don't manually manage min master nodes if not necessary * Remove some dead code * Allow for manually supplying list of seed nodes * Closes #35178
This commit is contained in:
parent
617f91bb0f
commit
529910a43c
|
@ -110,6 +110,14 @@ class ClusterConfiguration {
|
||||||
return seedNode.transportUri()
|
return seedNode.transportUri()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A closure to call which returns a manually supplied list of unicast seed hosts.
|
||||||
|
*/
|
||||||
|
@Input
|
||||||
|
Closure<List<String>> otherUnicastHostAddresses = {
|
||||||
|
Collections.emptyList()
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A closure to call before the cluster is considered ready. The closure is passed the node info,
|
* A closure to call before the cluster is considered ready. The closure is passed the node info,
|
||||||
* as well as a groovy AntBuilder, to enable running ant condition checks. The default wait
|
* as well as a groovy AntBuilder, to enable running ant condition checks. The default wait
|
||||||
|
|
|
@ -715,8 +715,9 @@ class ClusterFormationTasks {
|
||||||
wait.doLast {
|
wait.doLast {
|
||||||
|
|
||||||
Collection<String> unicastHosts = new HashSet<>()
|
Collection<String> unicastHosts = new HashSet<>()
|
||||||
nodes.forEach { otherNode ->
|
nodes.forEach { node ->
|
||||||
String unicastHost = otherNode.config.unicastTransportUri(otherNode, null, project.ant)
|
unicastHosts.addAll(node.config.otherUnicastHostAddresses.call())
|
||||||
|
String unicastHost = node.config.unicastTransportUri(node, null, project.ant)
|
||||||
if (unicastHost != null) {
|
if (unicastHost != null) {
|
||||||
unicastHosts.addAll(Arrays.asList(unicastHost.split(",")))
|
unicastHosts.addAll(Arrays.asList(unicastHost.split(",")))
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,6 @@ for (Version version : bwcVersions.wireCompatible) {
|
||||||
mustRunAfter(precommit)
|
mustRunAfter(precommit)
|
||||||
}
|
}
|
||||||
|
|
||||||
Object extension = extensions.findByName("${baseName}#oldClusterTestCluster")
|
|
||||||
configure(extensions.findByName("${baseName}#oldClusterTestCluster")) {
|
configure(extensions.findByName("${baseName}#oldClusterTestCluster")) {
|
||||||
bwcVersion = version
|
bwcVersion = version
|
||||||
numBwcNodes = 3
|
numBwcNodes = 3
|
||||||
|
@ -73,12 +72,12 @@ for (Version version : bwcVersions.wireCompatible) {
|
||||||
systemProperty 'tests.rest.suite', 'old_cluster'
|
systemProperty 'tests.rest.suite', 'old_cluster'
|
||||||
}
|
}
|
||||||
|
|
||||||
Closure configureUpgradeCluster = {String name, Task lastRunner, int stopNode, Closure unicastSeed ->
|
Closure configureUpgradeCluster = {String name, Task lastRunner, int stopNode, Closure getOtherUnicastHostAddresses ->
|
||||||
configure(extensions.findByName("${baseName}#${name}")) {
|
configure(extensions.findByName("${baseName}#${name}")) {
|
||||||
dependsOn lastRunner, "${baseName}#oldClusterTestCluster#node${stopNode}.stop"
|
dependsOn lastRunner, "${baseName}#oldClusterTestCluster#node${stopNode}.stop"
|
||||||
clusterName = 'rolling-upgrade'
|
clusterName = 'rolling-upgrade'
|
||||||
unicastTransportUri = { seedNode, node, ant -> unicastSeed() }
|
otherUnicastHostAddresses = { getOtherUnicastHostAddresses() }
|
||||||
minimumMasterNodes = { 3 }
|
minimumMasterNodes = { 2 }
|
||||||
/* Override the data directory so the new node always gets the node we
|
/* Override the data directory so the new node always gets the node we
|
||||||
* just stopped's data directory. */
|
* just stopped's data directory. */
|
||||||
dataDir = { nodeNumber -> oldClusterTest.nodes[stopNode].dataDir }
|
dataDir = { nodeNumber -> oldClusterTest.nodes[stopNode].dataDir }
|
||||||
|
@ -91,7 +90,7 @@ for (Version version : bwcVersions.wireCompatible) {
|
||||||
|
|
||||||
configureUpgradeCluster("oneThirdUpgradedTestCluster", oldClusterTestRunner, 0,
|
configureUpgradeCluster("oneThirdUpgradedTestCluster", oldClusterTestRunner, 0,
|
||||||
// Use all running nodes as seed nodes so there is no race between pinging and the tests
|
// 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() })
|
{ [oldClusterTest.nodes.get(1).transportUri(), oldClusterTest.nodes.get(2).transportUri()] })
|
||||||
|
|
||||||
Task oneThirdUpgradedTestRunner = tasks.getByName("${baseName}#oneThirdUpgradedTestRunner")
|
Task oneThirdUpgradedTestRunner = tasks.getByName("${baseName}#oneThirdUpgradedTestRunner")
|
||||||
oneThirdUpgradedTestRunner.configure {
|
oneThirdUpgradedTestRunner.configure {
|
||||||
|
@ -104,7 +103,7 @@ for (Version version : bwcVersions.wireCompatible) {
|
||||||
|
|
||||||
configureUpgradeCluster("twoThirdsUpgradedTestCluster", oneThirdUpgradedTestRunner, 1,
|
configureUpgradeCluster("twoThirdsUpgradedTestCluster", oneThirdUpgradedTestRunner, 1,
|
||||||
// Use all running nodes as seed nodes so there is no race between pinging and the tests
|
// 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() })
|
{ [oldClusterTest.nodes.get(2).transportUri(), oneThirdUpgradedTest.nodes.get(0).transportUri()] })
|
||||||
|
|
||||||
Task twoThirdsUpgradedTestRunner = tasks.getByName("${baseName}#twoThirdsUpgradedTestRunner")
|
Task twoThirdsUpgradedTestRunner = tasks.getByName("${baseName}#twoThirdsUpgradedTestRunner")
|
||||||
twoThirdsUpgradedTestRunner.configure {
|
twoThirdsUpgradedTestRunner.configure {
|
||||||
|
@ -117,7 +116,7 @@ for (Version version : bwcVersions.wireCompatible) {
|
||||||
|
|
||||||
configureUpgradeCluster("upgradedClusterTestCluster", twoThirdsUpgradedTestRunner, 2,
|
configureUpgradeCluster("upgradedClusterTestCluster", twoThirdsUpgradedTestRunner, 2,
|
||||||
// Use all running nodes as seed nodes so there is no race between pinging and the tests
|
// 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() })
|
{ [oneThirdUpgradedTest.nodes.get(0).transportUri(), twoThirdsUpgradedTest.nodes.get(0).transportUri()] })
|
||||||
|
|
||||||
Task upgradedClusterTestRunner = tasks.getByName("${baseName}#upgradedClusterTestRunner")
|
Task upgradedClusterTestRunner = tasks.getByName("${baseName}#upgradedClusterTestRunner")
|
||||||
upgradedClusterTestRunner.configure {
|
upgradedClusterTestRunner.configure {
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
import org.elasticsearch.gradle.Version
|
import org.elasticsearch.gradle.Version
|
||||||
import org.elasticsearch.gradle.test.NodeInfo
|
|
||||||
import org.elasticsearch.gradle.test.RestIntegTestTask
|
import org.elasticsearch.gradle.test.RestIntegTestTask
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets
|
|
||||||
|
|
||||||
apply plugin: 'elasticsearch.standalone-test'
|
apply plugin: 'elasticsearch.standalone-test'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
@ -40,7 +37,6 @@ for (Version version : bwcVersions.wireCompatible) {
|
||||||
bwcVersion = version
|
bwcVersion = version
|
||||||
numBwcNodes = 3
|
numBwcNodes = 3
|
||||||
numNodes = 3
|
numNodes = 3
|
||||||
minimumMasterNodes = { 3 }
|
|
||||||
clusterName = 'rolling-upgrade-basic'
|
clusterName = 'rolling-upgrade-basic'
|
||||||
setting 'xpack.security.enabled', 'false'
|
setting 'xpack.security.enabled', 'false'
|
||||||
setting 'xpack.monitoring.enabled', 'false'
|
setting 'xpack.monitoring.enabled', 'false'
|
||||||
|
@ -54,12 +50,12 @@ for (Version version : bwcVersions.wireCompatible) {
|
||||||
systemProperty 'tests.rest.suite', 'old_cluster'
|
systemProperty 'tests.rest.suite', 'old_cluster'
|
||||||
}
|
}
|
||||||
|
|
||||||
Closure configureUpgradeCluster = {String name, Task lastRunner, int stopNode, Closure unicastSeed ->
|
Closure configureUpgradeCluster = {String name, Task lastRunner, int stopNode, Closure getOtherUnicastHostAddresses ->
|
||||||
configure(extensions.findByName("${baseName}#${name}")) {
|
configure(extensions.findByName("${baseName}#${name}")) {
|
||||||
dependsOn lastRunner, "${baseName}#oldClusterTestCluster#node${stopNode}.stop"
|
dependsOn lastRunner, "${baseName}#oldClusterTestCluster#node${stopNode}.stop"
|
||||||
clusterName = 'rolling-upgrade-basic'
|
clusterName = 'rolling-upgrade-basic'
|
||||||
unicastTransportUri = { seedNode, node, ant -> unicastSeed() }
|
otherUnicastHostAddresses = { getOtherUnicastHostAddresses() }
|
||||||
minimumMasterNodes = { 3 }
|
minimumMasterNodes = { 2 }
|
||||||
/* Override the data directory so the new node always gets the node we
|
/* Override the data directory so the new node always gets the node we
|
||||||
* just stopped's data directory. */
|
* just stopped's data directory. */
|
||||||
dataDir = { nodeNumber -> oldClusterTest.nodes[stopNode].dataDir }
|
dataDir = { nodeNumber -> oldClusterTest.nodes[stopNode].dataDir }
|
||||||
|
@ -77,7 +73,7 @@ for (Version version : bwcVersions.wireCompatible) {
|
||||||
|
|
||||||
configureUpgradeCluster("oneThirdUpgradedTestCluster", oldClusterTestRunner, 0,
|
configureUpgradeCluster("oneThirdUpgradedTestCluster", oldClusterTestRunner, 0,
|
||||||
// Use all running nodes as seed nodes so there is no race between pinging and the tests
|
// 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() })
|
{ [oldClusterTest.nodes.get(1).transportUri(), oldClusterTest.nodes.get(2).transportUri()] })
|
||||||
|
|
||||||
Task oneThirdUpgradedTestRunner = tasks.getByName("${baseName}#oneThirdUpgradedTestRunner")
|
Task oneThirdUpgradedTestRunner = tasks.getByName("${baseName}#oneThirdUpgradedTestRunner")
|
||||||
oneThirdUpgradedTestRunner.configure {
|
oneThirdUpgradedTestRunner.configure {
|
||||||
|
@ -90,7 +86,7 @@ for (Version version : bwcVersions.wireCompatible) {
|
||||||
|
|
||||||
configureUpgradeCluster("twoThirdsUpgradedTestCluster", oneThirdUpgradedTestRunner, 1,
|
configureUpgradeCluster("twoThirdsUpgradedTestCluster", oneThirdUpgradedTestRunner, 1,
|
||||||
// Use all running nodes as seed nodes so there is no race between pinging and the tests
|
// 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() })
|
{ [oldClusterTest.nodes.get(2).transportUri(), oneThirdUpgradedTest.nodes.get(0).transportUri()] })
|
||||||
|
|
||||||
Task twoThirdsUpgradedTestRunner = tasks.getByName("${baseName}#twoThirdsUpgradedTestRunner")
|
Task twoThirdsUpgradedTestRunner = tasks.getByName("${baseName}#twoThirdsUpgradedTestRunner")
|
||||||
twoThirdsUpgradedTestRunner.configure {
|
twoThirdsUpgradedTestRunner.configure {
|
||||||
|
@ -103,7 +99,7 @@ for (Version version : bwcVersions.wireCompatible) {
|
||||||
|
|
||||||
configureUpgradeCluster("upgradedClusterTestCluster", twoThirdsUpgradedTestRunner, 2,
|
configureUpgradeCluster("upgradedClusterTestCluster", twoThirdsUpgradedTestRunner, 2,
|
||||||
// Use all running nodes as seed nodes so there is no race between pinging and the tests
|
// 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() })
|
{ [oneThirdUpgradedTest.nodes.get(0).transportUri(), twoThirdsUpgradedTest.nodes.get(0).transportUri()] })
|
||||||
|
|
||||||
Task upgradedClusterTestRunner = tasks.getByName("${baseName}#upgradedClusterTestRunner")
|
Task upgradedClusterTestRunner = tasks.getByName("${baseName}#upgradedClusterTestRunner")
|
||||||
upgradedClusterTestRunner.configure {
|
upgradedClusterTestRunner.configure {
|
||||||
|
|
|
@ -120,7 +120,6 @@ subprojects {
|
||||||
mustRunAfter(precommit)
|
mustRunAfter(precommit)
|
||||||
}
|
}
|
||||||
|
|
||||||
Object extension = extensions.findByName("${baseName}#oldClusterTestCluster")
|
|
||||||
configure(extensions.findByName("${baseName}#oldClusterTestCluster")) {
|
configure(extensions.findByName("${baseName}#oldClusterTestCluster")) {
|
||||||
dependsOn copyTestNodeKeystore
|
dependsOn copyTestNodeKeystore
|
||||||
if (version.before('6.3.0')) {
|
if (version.before('6.3.0')) {
|
||||||
|
@ -135,7 +134,6 @@ subprojects {
|
||||||
bwcVersion = version
|
bwcVersion = version
|
||||||
numBwcNodes = 3
|
numBwcNodes = 3
|
||||||
numNodes = 3
|
numNodes = 3
|
||||||
minimumMasterNodes = { 3 }
|
|
||||||
clusterName = 'rolling-upgrade'
|
clusterName = 'rolling-upgrade'
|
||||||
waitCondition = waitWithAuth
|
waitCondition = waitWithAuth
|
||||||
setting 'xpack.monitoring.exporters._http.type', 'http'
|
setting 'xpack.monitoring.exporters._http.type', 'http'
|
||||||
|
@ -183,13 +181,13 @@ subprojects {
|
||||||
systemProperty 'tests.rest.suite', 'old_cluster'
|
systemProperty 'tests.rest.suite', 'old_cluster'
|
||||||
}
|
}
|
||||||
|
|
||||||
Closure configureUpgradeCluster = {String name, Task lastRunner, int stopNode, Closure unicastSeed ->
|
Closure configureUpgradeCluster = {String name, Task lastRunner, int stopNode, Closure getOtherUnicastHostAddresses ->
|
||||||
configure(extensions.findByName("${baseName}#${name}")) {
|
configure(extensions.findByName("${baseName}#${name}")) {
|
||||||
dependsOn lastRunner, "${baseName}#oldClusterTestCluster#node${stopNode}.stop"
|
dependsOn lastRunner, "${baseName}#oldClusterTestCluster#node${stopNode}.stop"
|
||||||
setupCommand 'setupTestUser', 'bin/elasticsearch-users', 'useradd', 'test_user', '-p', 'x-pack-test-password', '-r', 'superuser'
|
setupCommand 'setupTestUser', 'bin/elasticsearch-users', 'useradd', 'test_user', '-p', 'x-pack-test-password', '-r', 'superuser'
|
||||||
clusterName = 'rolling-upgrade'
|
clusterName = 'rolling-upgrade'
|
||||||
unicastTransportUri = { seedNode, node, ant -> unicastSeed() }
|
otherUnicastHostAddresses = { getOtherUnicastHostAddresses() }
|
||||||
minimumMasterNodes = { 3 }
|
minimumMasterNodes = { 2 }
|
||||||
/* Override the data directory so the new node always gets the node we
|
/* Override the data directory so the new node always gets the node we
|
||||||
* just stopped's data directory. */
|
* just stopped's data directory. */
|
||||||
dataDir = { nodeNumber -> oldClusterTest.nodes[stopNode].dataDir }
|
dataDir = { nodeNumber -> oldClusterTest.nodes[stopNode].dataDir }
|
||||||
|
@ -224,7 +222,7 @@ subprojects {
|
||||||
|
|
||||||
configureUpgradeCluster("oneThirdUpgradedTestCluster", oldClusterTestRunner, 0,
|
configureUpgradeCluster("oneThirdUpgradedTestCluster", oldClusterTestRunner, 0,
|
||||||
// Use all running nodes as seed nodes so there is no race between pinging and the tests
|
// 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() })
|
{ [oldClusterTest.nodes.get(1).transportUri(), oldClusterTest.nodes.get(2).transportUri()] })
|
||||||
|
|
||||||
Task oneThirdUpgradedTestRunner = tasks.getByName("${baseName}#oneThirdUpgradedTestRunner")
|
Task oneThirdUpgradedTestRunner = tasks.getByName("${baseName}#oneThirdUpgradedTestRunner")
|
||||||
oneThirdUpgradedTestRunner.configure {
|
oneThirdUpgradedTestRunner.configure {
|
||||||
|
@ -243,7 +241,7 @@ subprojects {
|
||||||
|
|
||||||
configureUpgradeCluster("twoThirdsUpgradedTestCluster", oneThirdUpgradedTestRunner, 1,
|
configureUpgradeCluster("twoThirdsUpgradedTestCluster", oneThirdUpgradedTestRunner, 1,
|
||||||
// Use all running nodes as seed nodes so there is no race between pinging and the tests
|
// 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() })
|
{ [oldClusterTest.nodes.get(2).transportUri(), oneThirdUpgradedTest.nodes.get(0).transportUri()] })
|
||||||
|
|
||||||
Task twoThirdsUpgradedTestRunner = tasks.getByName("${baseName}#twoThirdsUpgradedTestRunner")
|
Task twoThirdsUpgradedTestRunner = tasks.getByName("${baseName}#twoThirdsUpgradedTestRunner")
|
||||||
twoThirdsUpgradedTestRunner.configure {
|
twoThirdsUpgradedTestRunner.configure {
|
||||||
|
@ -256,7 +254,7 @@ subprojects {
|
||||||
|
|
||||||
configureUpgradeCluster("upgradedClusterTestCluster", twoThirdsUpgradedTestRunner, 2,
|
configureUpgradeCluster("upgradedClusterTestCluster", twoThirdsUpgradedTestRunner, 2,
|
||||||
// Use all running nodes as seed nodes so there is no race between pinging and the tests
|
// 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() })
|
{ [oneThirdUpgradedTest.nodes.get(0).transportUri(), twoThirdsUpgradedTest.nodes.get(0).transportUri()] })
|
||||||
|
|
||||||
Task upgradedClusterTestRunner = tasks.getByName("${baseName}#upgradedClusterTestRunner")
|
Task upgradedClusterTestRunner = tasks.getByName("${baseName}#upgradedClusterTestRunner")
|
||||||
upgradedClusterTestRunner.configure {
|
upgradedClusterTestRunner.configure {
|
||||||
|
|
Loading…
Reference in New Issue