Define lifecycle tasks for running different types of packaging tests (#54134)
(cherry picked from commit fd54cb087413d0247f5b60df381d6229e96227d8)
This commit is contained in:
parent
6e2ec94086
commit
611d98a472
|
@ -106,10 +106,12 @@ public class DistroTestPlugin implements Plugin<Project> {
|
|||
TaskProvider<Copy> copyUpgradeTask = configureCopyUpgradeTask(project, upgradeVersion, upgradeDir);
|
||||
TaskProvider<Copy> copyPluginsTask = configureCopyPluginsTask(project, pluginsDir);
|
||||
|
||||
Map<ElasticsearchDistribution.Type, TaskProvider<?>> lifecyleTasks = lifecyleTasks(project, "distructiveDistroTest");
|
||||
TaskProvider<Task> destructiveDistroTest = project.getTasks().register("destructiveDistroTest");
|
||||
for (ElasticsearchDistribution distribution : distributions) {
|
||||
TaskProvider<?> destructiveTask = configureDistroTest(project, distribution, dockerSupport);
|
||||
destructiveDistroTest.configure(t -> t.dependsOn(destructiveTask));
|
||||
lifecyleTasks.get(distribution.getType()).configure(t -> t.dependsOn(destructiveTask));
|
||||
}
|
||||
Map<String, TaskProvider<?>> batsTests = new HashMap<>();
|
||||
configureBatsTest(project, "plugins", distributionsDir, copyDistributionsTask, copyPluginsTask).configure(
|
||||
|
@ -125,6 +127,7 @@ public class DistroTestPlugin implements Plugin<Project> {
|
|||
List<Object> vmDependencies = new ArrayList<>(configureVM(vmProject));
|
||||
vmDependencies.add(project.getConfigurations().getByName("testRuntimeClasspath"));
|
||||
|
||||
Map<ElasticsearchDistribution.Type, TaskProvider<?>> vmLifecyleTasks = lifecyleTasks(vmProject, "distroTest");
|
||||
TaskProvider<Task> distroTest = vmProject.getTasks().register("distroTest");
|
||||
for (ElasticsearchDistribution distribution : distributions) {
|
||||
String destructiveTaskName = destructiveDistroTestTaskName(distribution);
|
||||
|
@ -139,6 +142,7 @@ public class DistroTestPlugin implements Plugin<Project> {
|
|||
);
|
||||
vmTask.configure(t -> t.dependsOn(distribution));
|
||||
|
||||
vmLifecyleTasks.get(distribution.getType()).configure(t -> t.dependsOn(vmTask));
|
||||
distroTest.configure(t -> {
|
||||
// Only VM sub-projects that are specifically opted-in to testing Docker should
|
||||
// have the Docker task added as a dependency. Although we control whether Docker
|
||||
|
@ -168,6 +172,17 @@ public class DistroTestPlugin implements Plugin<Project> {
|
|||
});
|
||||
}
|
||||
|
||||
private static Map<ElasticsearchDistribution.Type, TaskProvider<?>> lifecyleTasks(Project project, String taskPrefix) {
|
||||
Map<ElasticsearchDistribution.Type, TaskProvider<?>> lifecyleTasks = new HashMap<>();
|
||||
|
||||
lifecyleTasks.put(Type.DOCKER, project.getTasks().register(taskPrefix + ".docker"));
|
||||
lifecyleTasks.put(Type.ARCHIVE, project.getTasks().register(taskPrefix + ".archives"));
|
||||
lifecyleTasks.put(Type.DEB, project.getTasks().register(taskPrefix + ".packages"));
|
||||
lifecyleTasks.put(Type.RPM, lifecyleTasks.get(Type.DEB));
|
||||
|
||||
return lifecyleTasks;
|
||||
}
|
||||
|
||||
private static Jdk createJdk(
|
||||
NamedDomainObjectContainer<Jdk> jdksContainer,
|
||||
String name,
|
||||
|
|
Loading…
Reference in New Issue