Skip to content

Commit fe73fb7

Browse files
authored
Retry tests in CI (#7106)
1 parent 3d33553 commit fe73fb7

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

buildSrc/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ dependencies {
5656
implementation("com.diffplug.spotless:spotless-plugin-gradle:7.0.2")
5757
// Needed for japicmp but not automatically brought in for some reason.
5858
implementation("com.google.guava:guava:33.4.0-jre")
59+
implementation("com.gradle.develocity:com.gradle.develocity.gradle.plugin:3.19.1")
5960
implementation("com.squareup:javapoet:1.13.0")
6061
implementation("com.squareup.wire:wire-compiler")
6162
implementation("com.squareup.wire:wire-gradle-plugin")

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,14 @@ tasks {
113113
)
114114
}
115115

116+
val defaultMaxRetries = if (System.getenv().containsKey("CI")) 2 else 0
117+
val maxTestRetries = gradle.startParameter.projectProperties["maxTestRetries"]?.toInt() ?: defaultMaxRetries
118+
119+
develocity.testRetry {
120+
// You can see tests that were retried by this mechanism in the collected test reports and build scans.
121+
maxRetries.set(maxTestRetries);
122+
}
123+
116124
testLogging {
117125
exceptionFormat = TestExceptionFormat.FULL
118126
showExceptions = true

0 commit comments

Comments
 (0)