Skip to content

Commit c5eb394

Browse files
committed
Merge branch '3.4.x'
Closes gh-44915
2 parents 13bd614 + 68041de commit c5eb394

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

buildSrc/src/main/java/org/springframework/boot/build/test/DockerTestBuildService.java

+15-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,8 +22,10 @@
2222
import org.gradle.api.services.BuildServiceParameters;
2323

2424
/**
25-
* Build service for Docker-based tests. Configured to only allow serial execution,
26-
* thereby ensuring that Docker-based tests do not run in parallel.
25+
* Build service for Docker-based tests. The maximum number of {@code dockerTest} tasks
26+
* that can run in parallel can be configured using
27+
* {@code org.springframework.boot.dockertest.max-parallel-tasks}. By default, only a
28+
* single {@code dockerTest} task will run at a time.
2729
*
2830
* @author Andy Wilkinson
2931
*/
@@ -32,7 +34,16 @@ abstract class DockerTestBuildService implements BuildService<BuildServiceParame
3234
static Provider<DockerTestBuildService> registerIfNecessary(Project project) {
3335
return project.getGradle()
3436
.getSharedServices()
35-
.registerIfAbsent("dockerTest", DockerTestBuildService.class, (spec) -> spec.getMaxParallelUsages().set(1));
37+
.registerIfAbsent("dockerTest", DockerTestBuildService.class,
38+
(spec) -> spec.getMaxParallelUsages().set(maxParallelTasks(project)));
39+
}
40+
41+
private static int maxParallelTasks(Project project) {
42+
Object property = project.findProperty("org.springframework.boot.dockertest.max-parallel-tasks");
43+
if (property == null) {
44+
return 1;
45+
}
46+
return Integer.parseInt(property.toString());
3647
}
3748

3849
}

0 commit comments

Comments
 (0)