Skip to content

Commit 3255ae4

Browse files
committed
Add retry for flaky tests.
1 parent 08a67fb commit 3255ae4

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

gradle/special-tests.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
1+
apply plugin: 'org.gradle.test-retry'
2+
13
def special = [
24
'Npm',
35
'Black',
46
'Clang'
57
]
68

9+
boolean isCiServer = true
710
tasks.named('test') {
811
// See com.diffplug.spotless.tag package for available JUnit 5 @Tag annotations
912
useJUnitPlatform {
1013
excludeTags special as String[]
1114
}
15+
if (isCiServer) {
16+
retry {
17+
maxRetries = 2
18+
maxFailures = 2
19+
}
20+
}
1221
}
1322

1423
special.forEach { tag ->

settings.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ pluginManagement {
99
id 'com.github.spotbugs' version '4.7.8'
1010
// https://github.com/diffplug/spotless-changelog
1111
id 'com.diffplug.spotless-changelog' version '2.2.0'
12+
// https://github.com/gradle/test-retry-gradle-plugin/releases
13+
id 'org.gradle.test-retry' version '1.3.1'
1214
}
1315
}
1416
plugins {
@@ -17,6 +19,7 @@ plugins {
1719
id 'io.github.gradle-nexus.publish-plugin' apply false
1820
id 'com.github.spotbugs' apply false
1921
id 'com.diffplug.spotless-changelog' apply false
22+
id 'org.gradle.test-retry' apply false
2023
}
2124
if (System.env['CI'] != null) {
2225
// use the remote buildcache on all CI builds

0 commit comments

Comments
 (0)