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()
|
||||
}
|
||||
|
||||
/**
|
||||
* 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,
|
||||
* as well as a groovy AntBuilder, to enable running ant condition checks. The default wait
|
||||
|
|
|
@ -715,8 +715,9 @@ class ClusterFormationTasks {
|
|||
wait.doLast {
|
||||
|
||||
Collection<String> unicastHosts = new HashSet<>()
|
||||
nodes.forEach { otherNode ->
|
||||
String unicastHost = otherNode.config.unicastTransportUri(otherNode, null, project.ant)
|
||||
nodes.forEach { node ->
|
||||
unicastHosts.addAll(node.config.otherUnicastHostAddresses.call())
|
||||
String unicastHost = node.config.unicastTransportUri(node, null, project.ant)
|
||||
if (unicastHost != null) {
|
||||
unicastHosts.addAll(Arrays.asList(unicastHost.split(",")))
|
||||
}
|
||||
|
|
|
@ -56,7 +56,6 @@ for (Version version : bwcVersions.wireCompatible) {
|
|||
mustRunAfter(precommit)
|
||||
}
|
||||
|
||||
Object extension = extensions.findByName("${baseName}#oldClusterTestCluster")
|
||||
configure(extensions.findByName("${baseName}#oldClusterTestCluster")) {
|
||||
bwcVersion = version
|
||||
numBwcNodes = 3
|
||||
|
@ -73,12 +72,12 @@ for (Version version : bwcVersions.wireCompatible) {
|
|||
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}")) {
|
||||
dependsOn lastRunner, "${baseName}#oldClusterTestCluster#node${stopNode}.stop"
|
||||
clusterName = 'rolling-upgrade'
|
||||
unicastTransportUri = { seedNode, node, ant -> unicastSeed() }
|
||||
minimumMasterNodes = { 3 }
|
||||
otherUnicastHostAddresses = { getOtherUnicastHostAddresses() }
|
||||
minimumMasterNodes = { 2 }
|
||||
/* Override the data directory so the new node always gets the node we
|
||||
* just stopped's data directory. */
|
||||
dataDir = { nodeNumber -> oldClusterTest.nodes[stopNode].dataDir }
|
||||
|
@ -91,7 +90,7 @@ for (Version version : bwcVersions.wireCompatible) {
|
|||
|
||||
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() })
|
||||
{ [oldClusterTest.nodes.get(1).transportUri(), oldClusterTest.nodes.get(2).transportUri()] })
|
||||
|
||||
Task oneThirdUpgradedTestRunner = tasks.getByName("${baseName}#oneThirdUpgradedTestRunner")
|
||||
oneThirdUpgradedTestRunner.configure {
|
||||
|
@ -104,7 +103,7 @@ for (Version version : bwcVersions.wireCompatible) {
|
|||
|
||||
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() })
|
||||
{ [oldClusterTest.nodes.get(2).transportUri(), oneThirdUpgradedTest.nodes.get(0).transportUri()] })
|
||||
|
||||
Task twoThirdsUpgradedTestRunner = tasks.getByName("${baseName}#twoThirdsUpgradedTestRunner")
|
||||
twoThirdsUpgradedTestRunner.configure {
|
||||
|
@ -117,7 +116,7 @@ for (Version version : bwcVersions.wireCompatible) {
|
|||
|
||||
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() })
|
||||
{ [oneThirdUpgradedTest.nodes.get(0).transportUri(), twoThirdsUpgradedTest.nodes.get(0).transportUri()] })
|
||||
|
||||
Task upgradedClusterTestRunner = tasks.getByName("${baseName}#upgradedClusterTestRunner")
|
||||
upgradedClusterTestRunner.configure {
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
import org.elasticsearch.gradle.Version
|
||||
import org.elasticsearch.gradle.test.NodeInfo
|
||||
import org.elasticsearch.gradle.test.RestIntegTestTask
|
||||
|
||||
import java.nio.charset.StandardCharsets
|
||||
|
||||
apply plugin: 'elasticsearch.standalone-test'
|
||||
|
||||
dependencies {
|
||||
|
@ -40,7 +37,6 @@ for (Version version : bwcVersions.wireCompatible) {
|
|||
bwcVersion = version
|
||||
numBwcNodes = 3
|
||||
numNodes = 3
|
||||
minimumMasterNodes = { 3 }
|
||||
clusterName = 'rolling-upgrade-basic'
|
||||
setting 'xpack.security.enabled', 'false'
|
||||
setting 'xpack.monitoring.enabled', 'false'
|
||||
|
@ -54,12 +50,12 @@ for (Version version : bwcVersions.wireCompatible) {
|
|||
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}")) {
|
||||
dependsOn lastRunner, "${baseName}#oldClusterTestCluster#node${stopNode}.stop"
|
||||
clusterName = 'rolling-upgrade-basic'
|
||||
unicastTransportUri = { seedNode, node, ant -> unicastSeed() }
|
||||
minimumMasterNodes = { 3 }
|
||||
otherUnicastHostAddresses = { getOtherUnicastHostAddresses() }
|
||||
minimumMasterNodes = { 2 }
|
||||
/* Override the data directory so the new node always gets the node we
|
||||
* just stopped's data directory. */
|
||||
dataDir = { nodeNumber -> oldClusterTest.nodes[stopNode].dataDir }
|
||||
|
@ -77,7 +73,7 @@ for (Version version : bwcVersions.wireCompatible) {
|
|||
|
||||
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() })
|
||||
{ [oldClusterTest.nodes.get(1).transportUri(), oldClusterTest.nodes.get(2).transportUri()] })
|
||||
|
||||
Task oneThirdUpgradedTestRunner = tasks.getByName("${baseName}#oneThirdUpgradedTestRunner")
|
||||
oneThirdUpgradedTestRunner.configure {
|
||||
|
@ -90,7 +86,7 @@ for (Version version : bwcVersions.wireCompatible) {
|
|||
|
||||
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() })
|
||||
{ [oldClusterTest.nodes.get(2).transportUri(), oneThirdUpgradedTest.nodes.get(0).transportUri()] })
|
||||
|
||||
Task twoThirdsUpgradedTestRunner = tasks.getByName("${baseName}#twoThirdsUpgradedTestRunner")
|
||||
twoThirdsUpgradedTestRunner.configure {
|
||||
|
@ -103,7 +99,7 @@ for (Version version : bwcVersions.wireCompatible) {
|
|||
|
||||
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() })
|
||||
{ [oneThirdUpgradedTest.nodes.get(0).transportUri(), twoThirdsUpgradedTest.nodes.get(0).transportUri()] })
|
||||
|
||||
Task upgradedClusterTestRunner = tasks.getByName("${baseName}#upgradedClusterTestRunner")
|
||||
upgradedClusterTestRunner.configure {
|
||||
|
|
|
@ -120,7 +120,6 @@ subprojects {
|
|||
mustRunAfter(precommit)
|
||||
}
|
||||
|
||||
Object extension = extensions.findByName("${baseName}#oldClusterTestCluster")
|
||||
configure(extensions.findByName("${baseName}#oldClusterTestCluster")) {
|
||||
dependsOn copyTestNodeKeystore
|
||||
if (version.before('6.3.0')) {
|
||||
|
@ -135,7 +134,6 @@ subprojects {
|
|||
bwcVersion = version
|
||||
numBwcNodes = 3
|
||||
numNodes = 3
|
||||
minimumMasterNodes = { 3 }
|
||||
clusterName = 'rolling-upgrade'
|
||||
waitCondition = waitWithAuth
|
||||
setting 'xpack.monitoring.exporters._http.type', 'http'
|
||||
|
@ -183,13 +181,13 @@ subprojects {
|
|||
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}")) {
|
||||
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'
|
||||
unicastTransportUri = { seedNode, node, ant -> unicastSeed() }
|
||||
minimumMasterNodes = { 3 }
|
||||
otherUnicastHostAddresses = { getOtherUnicastHostAddresses() }
|
||||
minimumMasterNodes = { 2 }
|
||||
/* Override the data directory so the new node always gets the node we
|
||||
* just stopped's data directory. */
|
||||
dataDir = { nodeNumber -> oldClusterTest.nodes[stopNode].dataDir }
|
||||
|
@ -224,7 +222,7 @@ subprojects {
|
|||
|
||||
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() })
|
||||
{ [oldClusterTest.nodes.get(1).transportUri(), oldClusterTest.nodes.get(2).transportUri()] })
|
||||
|
||||
Task oneThirdUpgradedTestRunner = tasks.getByName("${baseName}#oneThirdUpgradedTestRunner")
|
||||
oneThirdUpgradedTestRunner.configure {
|
||||
|
@ -243,7 +241,7 @@ subprojects {
|
|||
|
||||
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() })
|
||||
{ [oldClusterTest.nodes.get(2).transportUri(), oneThirdUpgradedTest.nodes.get(0).transportUri()] })
|
||||
|
||||
Task twoThirdsUpgradedTestRunner = tasks.getByName("${baseName}#twoThirdsUpgradedTestRunner")
|
||||
twoThirdsUpgradedTestRunner.configure {
|
||||
|
@ -256,7 +254,7 @@ subprojects {
|
|||
|
||||
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() })
|
||||
{ [oneThirdUpgradedTest.nodes.get(0).transportUri(), twoThirdsUpgradedTest.nodes.get(0).transportUri()] })
|
||||
|
||||
Task upgradedClusterTestRunner = tasks.getByName("${baseName}#upgradedClusterTestRunner")
|
||||
upgradedClusterTestRunner.configure {
|
||||
|
|
Loading…
Reference in New Issue