Tests: Ensure multi node integ tests wait on first node

When a rest integ test has multiple nodes, each node is supposed to not
start configuring itself until the first node has been started, so that
the unicast host information can be written. However, this was never
explicitly setup to occur, and we were just very lucky with the current
gradle version and stability of the code always produced a task graph
that had node0 starting first. With the recent refactorings to integ
tests, the order has changed. This commit fixes the ordering by adding
an explicit dependency between the first node and the other nodes.
This commit is contained in:
Ryan Ernst 2017-02-22 20:51:35 -08:00
parent 6ca90a61a6
commit de8049fd2a
1 changed files with 3 additions and 2 deletions

View File

@ -62,7 +62,7 @@ class ClusterFormationTasks {
sharedDir.mkdirs() sharedDir.mkdirs()
} }
} }
List<Task> startTasks = [cleanup] List<Task> startTasks = []
List<NodeInfo> nodes = [] List<NodeInfo> nodes = []
if (config.numNodes < config.numBwcNodes) { if (config.numNodes < config.numBwcNodes) {
throw new GradleException("numNodes must be >= numBwcNodes [${config.numNodes} < ${config.numBwcNodes}]") throw new GradleException("numNodes must be >= numBwcNodes [${config.numNodes} < ${config.numBwcNodes}]")
@ -102,7 +102,8 @@ class ClusterFormationTasks {
} }
NodeInfo node = new NodeInfo(config, i, project, prefix, elasticsearchVersion, sharedDir) NodeInfo node = new NodeInfo(config, i, project, prefix, elasticsearchVersion, sharedDir)
nodes.add(node) nodes.add(node)
startTasks.add(configureNode(project, prefix, runner, cleanup, node, distro, nodes.get(0))) Task dependsOn = startTasks.empty ? cleanup : startTasks.get(0)
startTasks.add(configureNode(project, prefix, runner, dependsOn, node, distro, nodes.get(0)))
} }
Task wait = configureWaitTask("${prefix}#wait", project, nodes, startTasks) Task wait = configureWaitTask("${prefix}#wait", project, nodes, startTasks)