Skip to content

Commit

Permalink
Don't add repository to buildscript for base class tests
Browse files Browse the repository at this point in the history
- The base class tests depend upon CC's eager resolution failing due to a lack of repositories definied.  So if we
define them in the setup method, those builds succeed, when expected to fail, thus failing tests.
- Need to specific repo in every new test then.
  • Loading branch information
tresat committed Sep 16, 2022
1 parent 1ae7049 commit 6ff69c5
Showing 1 changed file with 18 additions and 2 deletions.
Expand Up @@ -30,20 +30,26 @@ class CheckstylePluginIntegrationTest extends WellBehavedPluginTest {
return "check"
}

/**
* To ensure the plugins fails (as expected) with configuration cache, do NOT add a repository to the build here,

This comment has been minimized.

Copy link
@abstratt

abstratt Sep 16, 2022

Member

This is fine, but just to clarify, so would actually remove the expectation for a build failure under CC for tests in this class (see test cases in super class). We do want to be able to run test cases successfully under CC, and adding a repo in the config is a common fix.

This comment has been minimized.

Copy link
@tresat

tresat Sep 23, 2022

Author Member

I was wondering about that. I will create a separate PR to fix these tests. I wanted to limit the scope of this change.

* the tests in the base class are relying on a failure during eager dependency resolution with CC.
*/
def setup() {
buildFile << """
apply plugin: 'groovy'
${mavenCentralRepository()}
"""
}


@Issue("https://github.com/gradle/gradle/issues/21301")
def "can pass a URL in configProperties"() {
given:
buildFile """
apply plugin: 'checkstyle'
dependencies { implementation localGroovy() }
${mavenCentralRepository()}
dependencies { implementation localGroovy() }
checkstyle {
Expand All @@ -69,6 +75,8 @@ class CheckstylePluginIntegrationTest extends WellBehavedPluginTest {
buildFile """
apply plugin: 'checkstyle'
${mavenCentralRepository()}
checkstyle {
enableExternalDtdLoad = true
}
Expand All @@ -95,6 +103,8 @@ class CheckstylePluginIntegrationTest extends WellBehavedPluginTest {
buildFile """
apply plugin: 'checkstyle'
${mavenCentralRepository()}
tasks.withType(Checkstyle).configureEach {
enableExternalDtdLoad = true
}
Expand All @@ -121,6 +131,8 @@ class CheckstylePluginIntegrationTest extends WellBehavedPluginTest {
buildFile """
apply plugin: 'checkstyle'
${mavenCentralRepository()}
checkstyle {
enableExternalDtdLoad = false
}
Expand Down Expand Up @@ -151,6 +163,8 @@ class CheckstylePluginIntegrationTest extends WellBehavedPluginTest {
buildFile """
apply plugin: 'checkstyle'
${mavenCentralRepository()}
checkstyle {
enableExternalDtdLoad = false
}
Expand All @@ -172,6 +186,8 @@ class CheckstylePluginIntegrationTest extends WellBehavedPluginTest {
def "enable_external_dtd_load feature NOT enabled by default"() {
given:buildFile """
apply plugin: 'checkstyle'
${mavenCentralRepository()}
"""

file('src/main/java/org/sample/MyClass.java') << multilineJavaClass()
Expand Down

0 comments on commit 6ff69c5

Please sign in to comment.