Skip to content

Commit

Permalink
Fix task dependency wiring for multi node test clusters (#74692)
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 authored Jun 30, 2021
1 parent f50ea6a commit c328cb7
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
package org.elasticsearch.gradle.testclusters;

import org.gradle.api.Action;
import org.gradle.api.Task;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.tasks.Nested;
Expand All @@ -24,11 +25,9 @@ default void useCluster(ElasticsearchCluster cluster) {
throw new TestClustersException("Task " + getPath() + " can't use test cluster from" + " another project " + cluster);
}

cluster.getNodes()
.stream()
.flatMap(node -> node.getDistributions().stream())
.forEach(distro -> dependsOn(getProject().provider(() -> distro.maybeFreeze())));
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 c328cb7

Please sign in to comment.