mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-05 00:56:58 +08:00
Make predictive test selection opt-in
Closes gh-35869
This commit is contained in:
parent
b2ef9da154
commit
2084ae1d1f
@ -70,7 +70,8 @@ import org.springframework.util.StringUtils;
|
||||
* <li>with a max heap of 1024M
|
||||
* <li>to run after any Checkstyle and format checking tasks
|
||||
* <li>to enable retries with a maximum of three attempts when running on CI
|
||||
* <li>to use predictive test selection when running locally
|
||||
* <li>to use predictive test selection when the value of the
|
||||
* {@code ENABLE_PREDICTIVE_TEST_SELECTION} environment variable is {@code true}
|
||||
* </ul>
|
||||
* <li>A {@code testRuntimeOnly} dependency upon
|
||||
* {@code org.junit.platform:junit-platform-launcher} is added to projects with the
|
||||
@ -181,8 +182,12 @@ class JavaConventions {
|
||||
testRetry.getMaxRetries().set(isCi() ? 3 : 0);
|
||||
}
|
||||
|
||||
private boolean isCi() {
|
||||
return Boolean.parseBoolean(System.getenv("CI"));
|
||||
}
|
||||
|
||||
private void configurePredictiveTestSelection(Test test) {
|
||||
if (!isCi()) {
|
||||
if (isPredictiveTestSelectionEnabled()) {
|
||||
PredictiveTestSelectionExtension predictiveTestSelection = test.getExtensions()
|
||||
.getByType(PredictiveTestSelectionExtension.class);
|
||||
predictiveTestSelection.getEnabled().set(true);
|
||||
@ -191,8 +196,8 @@ class JavaConventions {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isCi() {
|
||||
return Boolean.parseBoolean(System.getenv("CI"));
|
||||
private boolean isPredictiveTestSelectionEnabled() {
|
||||
return Boolean.parseBoolean(System.getenv("ENABLE_PREDICTIVE_TEST_SELECTION"));
|
||||
}
|
||||
|
||||
private void configureJavadocConventions(Project project) {
|
||||
|
Loading…
Reference in New Issue
Block a user