mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-15 01:07:30 +08:00
Merge branch '2.3.x'
Closes gh-21699
This commit is contained in:
commit
15ec26171c
@ -109,15 +109,17 @@ class JavaConventions {
|
||||
test.useJUnitPlatform();
|
||||
test.setMaxHeapSize("1024M");
|
||||
});
|
||||
if (Boolean.parseBoolean(System.getenv("CI"))) {
|
||||
project.getPlugins().apply(TestRetryPlugin.class);
|
||||
project.getTasks().withType(Test.class,
|
||||
(test) -> project.getPlugins().withType(TestRetryPlugin.class, (testRetryPlugin) -> {
|
||||
TestRetryTaskExtension testRetry = test.getExtensions().getByType(TestRetryTaskExtension.class);
|
||||
testRetry.getFailOnPassedAfterRetry().set(true);
|
||||
testRetry.getMaxRetries().set(3);
|
||||
}));
|
||||
}
|
||||
project.getPlugins().apply(TestRetryPlugin.class);
|
||||
project.getTasks().withType(Test.class,
|
||||
(test) -> project.getPlugins().withType(TestRetryPlugin.class, (testRetryPlugin) -> {
|
||||
TestRetryTaskExtension testRetry = test.getExtensions().getByType(TestRetryTaskExtension.class);
|
||||
testRetry.getFailOnPassedAfterRetry().set(true);
|
||||
testRetry.getMaxRetries().set(isCi() ? 3 : 0);
|
||||
}));
|
||||
}
|
||||
|
||||
private boolean isCi() {
|
||||
return Boolean.parseBoolean(System.getenv("CI"));
|
||||
}
|
||||
|
||||
private void configureJavadocConventions(Project project) {
|
||||
|
@ -78,7 +78,7 @@ class ConventionsPluginTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testRetryIsConfiguredOnCI() throws IOException {
|
||||
void testRetryIsConfiguredWithThreeRetriesOnCI() throws IOException {
|
||||
try (PrintWriter out = new PrintWriter(new FileWriter(this.buildFile))) {
|
||||
out.println("plugins {");
|
||||
out.println(" id 'java'");
|
||||
@ -101,7 +101,7 @@ class ConventionsPluginTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testRetryIsNotConfiguredLocally() throws IOException {
|
||||
void testRetryIsConfiguredWithZeroRetriesLocally() throws IOException {
|
||||
try (PrintWriter out = new PrintWriter(new FileWriter(this.buildFile))) {
|
||||
out.println("plugins {");
|
||||
out.println(" id 'java'");
|
||||
@ -111,11 +111,16 @@ class ConventionsPluginTests {
|
||||
out.println("task retryConfig {");
|
||||
out.println(" doLast {");
|
||||
out.println(" println \"Retry plugin applied: ${plugins.hasPlugin('org.gradle.test-retry')}\"");
|
||||
out.println(" test.retry {");
|
||||
out.println(" println \"maxRetries: ${maxRetries.get()}\"");
|
||||
out.println(" println \"failOnPassedAfterRetry: ${failOnPassedAfterRetry.get()}\"");
|
||||
out.println(" }");
|
||||
out.println(" }");
|
||||
out.println("}");
|
||||
}
|
||||
assertThat(runGradle(Collections.singletonMap("CI", "local"), "retryConfig", "--stacktrace").getOutput())
|
||||
.contains("Retry plugin applied: false");
|
||||
.contains("Retry plugin applied: true").contains("maxRetries: 0")
|
||||
.contains("failOnPassedAfterRetry: true");
|
||||
}
|
||||
|
||||
private BuildResult runGradle(String... args) {
|
||||
|
Loading…
Reference in New Issue
Block a user