Skip to content

Commit

Permalink
Add Gradle Test Retry plugin for timing sensitive tests...
Browse files Browse the repository at this point in the history
prior to this commit we had sporadic failing tests due to timeouts.
We could either increase the timeouts at the cost of slowing the tests down,
or retry if they occasionally fail on CI.
  • Loading branch information
leonard84 committed Mar 13, 2022
1 parent f03d22c commit b9ad5fd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pluginManagement {
id "io.github.gradle-nexus.publish-plugin" version "1.1.0"
id "com.github.ben-manes.versions" version "0.39.0"
id "biz.aQute.bnd.builder" version "6.2.0"
id "org.gradle.test-retry" version "1.3.1"
}

includeBuild "build-logic"
Expand Down
16 changes: 16 additions & 0 deletions spock-core/core.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import aQute.bnd.gradle.Resolve

plugins {
id "biz.aQute.bnd.builder"
id "org.gradle.test-retry"
}

apply from: script("publishMaven")
Expand Down Expand Up @@ -108,3 +109,18 @@ def verifyOSGi = tasks.register('verifyOSGi', Resolve) {
tasks.named('check') {
dependsOn(verifyOSGi)
}

boolean isCiServer = System.env["CI"] || System.env["GITHUB_ACTIONS"]
if (isCiServer) {
test {
retry {
maxRetries = 2
maxFailures = 20

filter {
includeAnnotationClasses.add("spock.lang.Timeout")
includeAnnotationClasses.add("spock.lang.Isolated")
}
}
}
}

0 comments on commit b9ad5fd

Please sign in to comment.