gradle / test-retry-gradle-plugin

Gradle plugin to retry tests that have failed to mitigate test flakiness.
Apache License 2.0
222 stars 50 forks source link

Unexpected retry Block Functionality Without Explicit retry-test-gradle Plugin Application #310

Closed iamsanjay closed 2 weeks ago

iamsanjay commented 3 weeks ago

Hey everyone,

We are configuring the retry-test-gradle plugin in the Apache Solr project, and I added the following code to the default-testing.gradle file. I also included the required dependency. However, I noticed that the retry functionality works even without explicitly declaring the plugin. I'm unsure where this functionality is coming from. Could it be inherited from another plugin that I’m not aware of? If so, is there a way to trace its origin?

retry {
        maxRetries = 2
        maxFailures = 20
        failOnPassedAfterRetry = false
      }

https://github.com/apache/solr/blob/main/build.gradle https://github.com/apache/solr/blob/main/gradle/testing/defaults-tests.gradle

iamsanjay commented 3 weeks ago

I might have found the answer. Our project includes the following plugins:

plugins {
    id 'com.gradle.enterprise' version '3.15.1'
    id 'com.gradle.common-custom-user-data-gradle-plugin' version '1.12'
}

Upon further investigation, I discovered that the com.gradle.enterprise plugin includes a test-retry feature. I found this reference in the Gradle source code:

https://github.com/gradle/gradle/blob/6586eb029f216bf8acfbea7bcfcb7cde8518a689/build-logic-commons/gradle-plugin/build.gradle.kts#L29

pshevche commented 2 weeks ago

@iamsanjay , as you figured out, the Develocity/Gradle Enterprise plugin bundles the retry plugin. If you are using it, then I'd recommend to remove the explicit dependency on the retry plugin. The extensions configured and their functionality are equivalent.