Skip to content

Commit 586086b

Browse files
authored
Retry tests (#876)
1 parent fbf8304 commit 586086b

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

buildSrc/build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ dependencies {
1515
implementation("com.diffplug.spotless:spotless-plugin-gradle:6.18.0")
1616
implementation("net.ltgt.gradle:gradle-errorprone-plugin:3.1.0")
1717
implementation("net.ltgt.gradle:gradle-nullaway-plugin:1.6.0")
18+
implementation("com.gradle.enterprise:com.gradle.enterprise.gradle.plugin:3.13.2")
1819
}
1920

2021
spotless {
@@ -32,6 +33,6 @@ spotless {
3233
// also very hard to find out where this happens
3334
"ktlint_standard_wrapping" to "disabled"
3435
))
35-
target("**/*.gradle.kts",)
36+
target("**/*.gradle.kts")
3637
}
3738
}

buildSrc/src/main/kotlin/otel.java-conventions.gradle.kts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import com.gradle.enterprise.gradleplugin.testretry.retry
12
import io.opentelemetry.gradle.OtelJavaExtension
23
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
34

@@ -66,6 +67,13 @@ tasks {
6667
showCauses = true
6768
showStackTraces = true
6869
}
70+
71+
retry {
72+
// You can see tests that were retried by this mechanism in the collected test reports and build scans.
73+
if (System.getenv().containsKey("CI") || rootProject.hasProperty("retryTests")) {
74+
maxRetries.set(5)
75+
}
76+
}
6977
}
7078

7179
withType<Javadoc>().configureEach {

0 commit comments

Comments
 (0)