-
Notifications
You must be signed in to change notification settings - Fork 496
Open
Labels
bugSomething isn't workingSomething isn't workingtest providedAlready replicated with a unit test, using JUnit pioneer's ExpectedToFailAlready replicated with a unit test, using JUnit pioneer's ExpectedToFail
Description
What version of OpenRewrite are you using?
I am using
- OpenRewrite v1.2.3
- Maven/Gradle plugin v1.2.3
- rewrite-module v1.2.3
How are you running OpenRewrite?
- I was writing a custom recipe which internally uses one of the existing recipe RemoveDevelocityConfiguration. I had previously raised a similar issue in the past (Rewrite Recipe to remove build cache configuration for Develocity #5823), however the fix provided was not correct. I have included a PR that contains unit tests where the fix fails.
The tests that are present currently works because buildCache extension is added inside the develocity extension in the test cases. This is incorrect configuration.
The buildCache extension is made available by Gradle and not Develocity, so it will always be present as a standalone extension in the settings.gradle(.kts) file.
(Refer - https://docs.gradle.com/develocity/gradle/current/gradle-plugin/#using_the_develocity_connector)
What is the smallest, simplest way to reproduce the problem?
- PR that covers the failing tests - Fix Recipe to remove build cache configuration for Develocity #6465
buildCache {
remote(HttpBuildCache) {
url = "some-url"
push = true
enabled = true
}
}What did you expect to see?
// buildCache configuration removedWhat did you see instead?
Unit tests fail.
What is the full stack trace of any errors you encountered?
> Task :rewrite-gradle:test
RemoveDevelocityTest > develocityBuildCacheWithAdvancedConfiguration() FAILED
org.opentest4j.AssertionFailedError: [Unexpected result in "settings.gradle":
diff --git a/settings.gradle b/settings.gradle
index e69de29..3f74314 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -0,0 +1,9 @@
+
+
+buildCache {
+ remote(develocity.buildCache) {
+ enabled = true
+ push = true
+ // DevelocityBuildCache connector configuration
+ }
+}
\ No newline at end of file
]
expected:
""
but was:
"
buildCache {
remote(develocity.buildCache) {
enabled = true
push = true
// DevelocityBuildCache connector configuration
}
}"
at app//org.openrewrite.test.RewriteTest.assertContentEquals(RewriteTest.java:644)
at app//org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:534)
at app//org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:132)
at app//org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:127)
at app//org.openrewrite.gradle.plugins.RemoveDevelocityTest.develocityBuildCacheWithAdvancedConfiguration(RemoveDevelocityTest.java:123)
RemoveDevelocityTest > develocityBuildCacheConnectorConfiguration() FAILED
org.opentest4j.AssertionFailedError: [Unexpected result in "settings.gradle":
diff --git a/settings.gradle b/settings.gradle
index e69de29..0fcda9b 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -0,0 +1,8 @@
+
+
+buildCache {
+ remote(develocity.buildCache) {
+ // Build Cache connector is registered and configured
+ enabled = true
+ }
+}
\ No newline at end of file
]
expected:
""
but was:
"
buildCache {
remote(develocity.buildCache) {
// Build Cache connector is registered and configured
enabled = true
}
}"
at app//org.openrewrite.test.RewriteTest.assertContentEquals(RewriteTest.java:644)
at app//org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:534)
at app//org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:132)
at app//org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:127)
at app//org.openrewrite.gradle.plugins.RemoveDevelocityTest.develocityBuildCacheConnectorConfiguration(RemoveDevelocityTest.java:98)
4 tests completed, 2 failed
Are you interested in contributing a fix to OpenRewrite?
Yes, I will add a fix for this in my PR.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingtest providedAlready replicated with a unit test, using JUnit pioneer's ExpectedToFailAlready replicated with a unit test, using JUnit pioneer's ExpectedToFail
Type
Projects
Status
No status