From 84d3444600aaeeac6813505fe5bfbf9ffce760ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edd=C3=BA=20Mel=C3=A9ndez=20Gonzales?= Date: Thu, 7 Jul 2022 19:44:03 -0500 Subject: [PATCH] Add test-retry plugin (#5586) * Enable the plugin only in CI environment * Every test will retry up to 2 times. 3 runs per test in general * Disable retry if 5 tests (no retries are count) fail --- build.gradle | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/build.gradle b/build.gradle index 1458b3db027..8c956133b03 100644 --- a/build.gradle +++ b/build.gradle @@ -16,6 +16,7 @@ plugins { id 'com.github.johnrengelman.shadow' version '7.0.0' id 'me.champeau.gradle.japicmp' version '0.2.9' apply false id 'com.diffplug.spotless' version '6.3.0' apply false + id 'org.gradle.test-retry' version '1.4.0' } apply from: "$rootDir/gradle/ci-support.gradle" @@ -33,6 +34,7 @@ subprojects { apply from: "$rootDir/gradle/shading.gradle" apply plugin: 'com.diffplug.spotless' apply plugin: 'checkstyle' + apply plugin: 'org.gradle.test-retry' group = "org.testcontainers" @@ -86,6 +88,14 @@ subprojects { exceptionFormat = 'full' events "STARTED", "PASSED", "FAILED", "SKIPPED" } + ext.isCI = System.getenv("CI") != null + if (isCI) { + retry { + maxRetries = 2 + maxFailures = 5 + failOnPassedAfterRetry = false + } + } } tasks.withType(Test).all {