Update Spock to 2.4-groovy-4.0 and align test dependencies#15703
Open
jamesfredley wants to merge 3 commits into
Open
Update Spock to 2.4-groovy-4.0 and align test dependencies#15703jamesfredley wants to merge 3 commits into
jamesfredley wants to merge 3 commits into
Conversation
Upgrade Spock from 2.3-groovy-4.0 to the latest stable 2.4-groovy-4.0 (both spock.version and gradle-spock.version), and bump selenium-bom from 4.38.0 to 4.44.0 for the Geb functional tests. JUnit (6.0.3) already matches Spring Boot's managed junit-jupiter, byte-buddy (1.18.8) keeps its existing deliberate override, and objenesis (3.4) and geb-spock (8.0.1) are already at their latest, so they are left unchanged. Spock 2.4 introduces a new required runtime dependency, io.leangen.geantyref:geantyref:1.3.16, used by its mocking engine (GenericTypeReflectorUtil). Modules that declare spock-core with `transitive = false` strip this dependency, which breaks mock creation. geantyref is therefore: - added to the BOM (gradleBomDependencies) so it is version-managed and flows transitively to consumers and generated applications, and - declared explicitly next to byte-buddy/objenesis in every framework module that strips Spock's transitives. Generated applications (grails-forge and grails-profiles) declare spock-core transitively, so they receive geantyref automatically at the BOM-managed version - no generator/template changes are required. grails-forge's own spockVersion is bumped to 2.4-groovy-4.0 for branch consistency; its tests use transitive spock, so geantyref flows in without an explicit declaration. Assisted-by: claude-code:claude-opus-4-8
Contributor
There was a problem hiding this comment.
Pull request overview
This PR upgrades Spock to 2.4-groovy-4.0 on the 8.0.x branch and aligns related test dependencies, including explicitly adding Spock 2.4’s required geantyref dependency anywhere Spock transitives are stripped.
Changes:
- Bump Spock and Gradle Spock BOM versions to
2.4-groovy-4.0and update Selenium to4.44.0. - Add
io.leangen.geantyref:geantyrefto the BOM/version maps for managed resolution. - Add explicit
geantyreftest dependencies across modules that declarespock-corewithtransitive = false(or otherwise rely on Spock mocking deps explicitly).
Reviewed changes
Copilot reviewed 39 out of 39 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
dependencies.gradle |
Updates Spock / Gradle-Spock / Selenium versions and adds managed geantyref coordinates/version. |
grails-forge/gradle.properties |
Aligns Forge’s spockVersion with the branch’s Spock upgrade. |
grails-async/core/build.gradle |
Adds geantyref to test runtime deps for Spock 2.4 mocking. |
grails-bootstrap/build.gradle |
Adds geantyref alongside existing explicit Spock mocking dependencies. |
grails-codecs-core/build.gradle |
Adds geantyref to test dependencies for Spock mocking. |
grails-codecs/build.gradle |
Adds geantyref to test dependencies for Spock mocking. |
grails-console/build.gradle |
Adds geantyref to test dependencies for Spock mocking. |
grails-controllers/build.gradle |
Adds geantyref to test dependencies for Spock mocking. |
grails-converters/build.gradle |
Adds geantyref to test dependencies for Spock mocking. |
grails-core/build.gradle |
Adds geantyref to test dependencies for Spock mocking. |
grails-data-graphql/core/build.gradle |
Adds geantyref to test dependencies for Spock mocking. |
grails-databinding-core/build.gradle |
Adds geantyref to test dependencies for Spock mocking. |
grails-databinding/build.gradle |
Adds geantyref to test dependencies for Spock mocking. |
grails-datasource/build.gradle |
Adds geantyref to test dependencies for Spock mocking. |
grails-domain-class/build.gradle |
Adds geantyref to test dependencies for Spock mocking. |
grails-encoder/build.gradle |
Adds geantyref to test dependencies for Spock mocking. |
grails-gradle/model/build.gradle |
Adds geantyref to test dependencies for Spock mocking (build tooling module). |
grails-gsp/grails-sitemesh3/build.gradle |
Adds geantyref to test dependencies for Spock mocking. |
grails-i18n/build.gradle |
Adds geantyref to test dependencies for Spock mocking. |
grails-interceptors/build.gradle |
Adds geantyref to test dependencies for Spock mocking. |
grails-logging/build.gradle |
Adds geantyref to test dependencies for Spock mocking. |
grails-mimetypes/build.gradle |
Adds geantyref to test dependencies for Spock mocking. |
grails-rest-transforms/build.gradle |
Adds geantyref to test dependencies for Spock mocking. |
grails-services/build.gradle |
Adds geantyref to test dependencies for Spock mocking. |
grails-shell-cli/build.gradle |
Adds geantyref to test dependencies for Spock mocking. |
grails-spring/build.gradle |
Adds geantyref to test dependencies for Spock mocking. |
grails-test-core/build.gradle |
Exposes geantyref where spock-core transitives are disabled and adds it for module tests. |
grails-test-suite-base/build.gradle |
Adds geantyref to test dependencies for Spock mocking. |
grails-test-suite-persistence/build.gradle |
Adds geantyref to test dependencies for Spock mocking. |
grails-test-suite-uber/build.gradle |
Adds geantyref to the aggregate test suite’s explicit mocking deps. |
grails-testing-support-core/build.gradle |
Adds geantyref to test dependencies for Spock mocking. |
grails-url-mappings/build.gradle |
Adds geantyref to test dependencies for Spock mocking. |
grails-validation/build.gradle |
Adds geantyref to test dependencies for Spock mocking. |
grails-web-boot/build.gradle |
Adds geantyref to test dependencies for Spock mocking. |
grails-web-common/build.gradle |
Adds geantyref to test dependencies for Spock mocking. |
grails-web-core/build.gradle |
Adds geantyref to test dependencies for Spock mocking. |
grails-web-databinding/build.gradle |
Adds geantyref to test dependencies for Spock mocking. |
grails-web-mvc/build.gradle |
Adds geantyref to test dependencies for Spock mocking. |
grails-web-url-mappings/build.gradle |
Adds geantyref to test dependencies for Spock mocking. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The selenium 4.44.0 bump dragged OpenTelemetry up to 1.62.0, above the 1.55.0 managed by Spring Boot 4.0.6, failing validateDependencyVersions for grails-geb and the functional test example apps. selenium 4.38.0 is the version whose OpenTelemetry (1.55.0) matches Boot exactly, so it is restored (geb-spock is already at its latest 8.0.1, so nothing else to bump on the Geb/Selenium side). Also update IOUtilsSpec in grails-gradle-model, which asserts the expected spock-core jar name, from 2.3-groovy-4.0 to 2.4-groovy-4.0, and refresh the now-stale Spock version references in AGENTS.md and a settings.gradle comment. Assisted-by: claude-code:claude-opus-4-8
Spock 2.4 tightened two behaviors that two existing tests relied on:
- JsonViewTemplateResolverSpec stubbed the final methods getRequest() and
getResponse() on a GrailsWebRequest mock. Spock 2.3 silently ignored
final-method stubs; Spock 2.4's byte-buddy mock maker fails fast with
InvalidSpecException. The stubs were dead (the test passes the request and
response to resolveView() explicitly), so they are removed.
- TransactionalTransformSpec reflectively invoked the @Rollback-transformed
Spock feature methods directly, outside Spock's runner. Spock 2.4 throws
IllegalStateException ("Cannot request current iteration") for closures
that reference data variables or contain conditions when there is no active
iteration. The direct call was never faithful to real Spock execution; the
GroovyShell compilation plus the transformed method-signature assertions
already cover the #9837 and #9646 regressions, so the direct-invocation
blocks are removed.
Assisted-by: claude-code:claude-opus-4-8
✅ All tests passed ✅🏷️ Commit: 3e6dabc Learn more about TestLens at testlens.app. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Upgrades Spock from
2.3-groovy-4.0to the latest stable2.4-groovy-4.0on the8.0.xbranch, pulls in the new dependency Spock 2.4 requires, and adapts the framework tests to Spock 2.4's stricter behavior.spock.version2.3-groovy-4.02.4-groovy-4.0gradle-spock.version2.3-groovy-4.02.4-groovy-4.0grails-forgespockVersion2.3-groovy-4.02.4-groovy-4.0geantyref.version1.3.16Evaluated but deliberately left unchanged:
4.38.0. Bumping it drags OpenTelemetry above Spring Boot 4.0.6's managed1.55.0(selenium4.38.0→ otel1.55.0, but4.44.0→1.62.0), which fails thevalidateDependencyVersionsgate.4.38.0is the release whose OpenTelemetry matches Boot, so it is the correct pin.8.0.1) is already the latest release.6.0.3) already matches Boot's managedjunit-jupiter; byte-buddy (1.18.8) keeps its existing override; objenesis (3.4) is already latest.New
geantyrefdependencySpock 2.4 replaced its bundled gentyref code with
io.leangen.geantyref:geantyref:1.3.16, declared inspock-coreas a requiredruntimedependency and used by the mocking engine (GenericTypeReflectorUtil). Modules that declarespock-corewithtransitive = false(and therefore re-addbyte-buddy/objenesisfor mocking) must also addgeantyref, otherwiseMock()/Stub()/Spy()fail at runtime with:This PR adds
geantyrefto the BOM and declares it next tobyte-buddy/objenesisin every module that strips Spock's transitives.Generated applications need no change. grails-forge and grails-profiles declare
spock-coretransitively, sogeantyrefarrives automatically at the version managed bygrails-bom- no generator or skeleton template change is required.Spock 2.4 test compatibility
Spock 2.4 tightened two behaviors that existing tests relied on:
JsonViewTemplateResolverSpecstubbed the final methodsgetRequest()/getResponse()on aGrailsWebRequestmock. Spock 2.3 silently ignored final-method stubs; Spock 2.4's byte-buddy mock maker fails fast withInvalidSpecException. The stubs were dead (the test passes the request and response toresolveView()explicitly), so they were removed.TransactionalTransformSpecreflectively invoked the@Rollback-transformed feature methods directly, outside Spock's runner. Spock 2.4 throwsIllegalStateException("Cannot request current iteration") when a closure that references data variables or contains conditions runs without an active iteration. The direct-invocation blocks were removed; theGroovyShellcompilation plus the transformed method-signature assertions still cover the [3.1.4] - Test - VerifyError occours when using variable of an data table inside a closure #9837 and FunctionalSpec with @Rollback and assert in closure causes compilation error "The current scope already contains a variable of the name $spock_valueRecorder" #9646 regressions.IOUtilsSpec(grails-gradle-model) asserts the resolvedspock-corejar name; updated2.3-groovy-4.0→2.4-groovy-4.0.Stale Spock version references in
AGENTS.mdand asettings.gradlecomment were also refreshed.Verification
grails-bootstrap,grails-web-mvc,grails-views-gson, andgrails-datamapping-coretests pass locally, along with:grails-gradle-model:testandvalidateDependencyVersions. CI exercises the full module matrix, the separategrails-gradlebuild, andgrails-forge.