Skip to content

Commit

Permalink
Retry tests only on CI server (#5349)
Browse files Browse the repository at this point in the history
Retrying all tests by default is not great when developing tests. This
behavior could be missed by a developer and result in new flakiness
being introduced. This change will only enable retries when the "CI"
environment variable is present.

Signed-off-by: Andrew Ross <andrross@amazon.com>

Signed-off-by: Andrew Ross <andrross@amazon.com>
  • Loading branch information
andrross committed Nov 23, 2022
1 parent 08ac17f commit 741dc49
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -450,13 +450,16 @@ gradle.projectsEvaluated {
}

// test retry configuration
boolean isCiServer = System.getenv().containsKey("CI")
subprojects {
apply plugin: "org.gradle.test-retry"
tasks.withType(Test).configureEach {
retry {
if (isCiServer) {
maxRetries = 3
maxFailures = 10
}
failOnPassedAfterRetry = false
maxRetries = 3
maxFailures = 10
}
}
}
Expand Down

0 comments on commit 741dc49

Please sign in to comment.