Skip to content

Commit

Permalink
KAFKA-8164: Add support for retrying failed (apache#8019)
Browse files Browse the repository at this point in the history
Disabled by default, but enabled for Jenkins PR builds (maximum of 1 retry per
test with up to 5 retries for the test run).

Reviewers: Ismael Juma <[email protected]>
  • Loading branch information
viktorsomogyi authored Feb 6, 2020
1 parent 7ea636c commit 987f0ee
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ Change the log4j setting in either `clients/src/test/resources/log4j.properties`

./gradlew clients:test --tests RequestResponseTest

### Specifying test retries ###
By default, each failed test is retried once up to a maximum of five retries per test run. Tests are retried at the end of the test task. Adjust these parameters in the following way:

./gradlew test -PmaxTestRetries=1 -PmaxTestRetryFailures=5

See [Test Retry Gradle Plugin](https://github.com/gradle/test-retry-gradle-plugin) for more details.

### Generating test coverage reports ###
Generate coverage reports for the whole project:

Expand Down Expand Up @@ -191,6 +198,8 @@ The following options should be set with a `-P` switch, for example `./gradlew -
* `skipSigning`: skips signing of artifacts.
* `testLoggingEvents`: unit test events to be logged, separated by comma. For example `./gradlew -PtestLoggingEvents=started,passed,skipped,failed test`.
* `xmlSpotBugsReport`: enable XML reports for spotBugs. This also disables HTML reports as only one can be enabled at a time.
* `maxTestRetries`: the maximum number of retries for a failing test case.
* `maxTestRetryFailures`: maximum number of test failures before retrying is disabled for subsequent tests.

### Dependency Analysis ###

Expand Down
10 changes: 10 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ buildscript {
classpath "org.owasp:dependency-check-gradle:$versions.owaspDepCheckPlugin"
classpath "com.diffplug.spotless:spotless-plugin-gradle:$versions.spotlessPlugin"
classpath "com.github.spotbugs:spotbugs-gradle-plugin:$versions.spotbugsPlugin"
classpath "org.gradle:test-retry-gradle-plugin:$versions.testRetryPlugin"
}
}

Expand Down Expand Up @@ -97,6 +98,9 @@ ext {

userMaxForks = project.hasProperty('maxParallelForks') ? maxParallelForks.toInteger() : null

userMaxTestRetries = project.hasProperty('maxTestRetries') ? maxTestRetries.toInteger() : 0
userMaxTestRetryFailures = project.hasProperty('maxTestRetryFailures') ? maxTestRetryFailures.toInteger() : 0

skipSigning = project.hasProperty('skipSigning') && skipSigning.toBoolean()
shouldSign = !skipSigning && !version.endsWith("SNAPSHOT") && project.gradle.startParameter.taskNames.any { it.contains("upload") }

Expand Down Expand Up @@ -163,6 +167,7 @@ subprojects {
apply plugin: 'signing'
apply plugin: 'checkstyle'
apply plugin: "com.github.spotbugs"
apply plugin: 'org.gradle.test-retry'

sourceCompatibility = minJavaVersion
targetCompatibility = minJavaVersion
Expand Down Expand Up @@ -289,6 +294,11 @@ subprojects {
exceptionFormat = testExceptionFormat
}
logTestStdout.rehydrate(delegate, owner, this)()

retry {
maxRetries = userMaxTestRetries
maxFailures = userMaxTestRetryFailures
}
}

task integrationTest(type: Test, dependsOn: compileJava) {
Expand Down
1 change: 1 addition & 0 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ versions += [
spotbugs: "3.1.12",
spotbugsPlugin: "3.0.0",
spotlessPlugin: "3.27.1",
testRetryPlugin: "1.1.0",
zookeeper: "3.5.6",
zstd: "1.4.4-7"
]
Expand Down

0 comments on commit 987f0ee

Please sign in to comment.