Skip to content

Commit

Permalink
Fix task dependency wiring for multi node test clusters (#74692) (#74738
Browse files Browse the repository at this point in the history
)

* Fix task dependency wiring for multi node test clusters

for multi node test cluster configurations we accidentally miss calculating the proper
task dependencies in TestClusterAware. This moves the task dependency declaration
in TestClusterAware to use the live collection method nodes#all instead of nodes.forEach
which will also take nodes into account that are added later to the cluster _after_
this configuration block is triggered.

* Fix duplicate lines
  • Loading branch information
breskeby committed Jul 5, 2021
1 parent 3ee17fb commit 0c2e2f7
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,10 @@ default void useCluster(ElasticsearchCluster cluster) {
throw new TestClustersException("Task " + getPath() + " can't use test cluster from" + " another project " + cluster);
}

// Add configured distributions as task dependencies so they are built before starting the cluster
cluster.getNodes()
.stream()
.flatMap(node -> node.getDistributions().stream())
.forEach(distro -> dependsOn(getProject().provider(() -> distro.maybeFreeze())));

// Add legacy BWC JDK runtime as a dependency so it's downloaded before starting the cluster if necessary
cluster.getNodes().stream().map(node -> (Callable<Jdk>) node::getBwcJdk).forEach(this::dependsOn);
cluster.getNodes().forEach(node -> dependsOn((Callable<Collection<Configuration>>) node::getPluginAndModuleConfigurations));
cluster.getNodes().all(node -> node.getDistributions().stream()
.forEach(distro -> dependsOn(getProject().provider(() -> distro.maybeFreeze()))));
cluster.getNodes().all(node -> dependsOn((Callable<Collection<Configuration>>) node::getPluginAndModuleConfigurations));
getClusters().add(cluster);
}

Expand Down

0 comments on commit 0c2e2f7

Please sign in to comment.