Skip to content

Remove the test suites' isolation settings that test-config.gradle overrides - #16839

Merged
jdaugherty merged 2 commits into
apache:8.0.xfrom
matrei:build/test-suite-isolation-cleanup
Nov 4, 2026
Merged

jdaugherty merged 2 commits into
apache:8.0.xfrom
matrei:build/test-suite-isolation-cleanup

Conversation

@matrei

@matrei matrei commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Description

gradle/test-config.gradle configures every Test task in a configureEach that runs after the build script that applies it, and it assigned excludes, so the settings the test suites made before applying it were replaced or overridden. This removes the settings that had stopped doing anything, and the isolation that had stopped isolating.

  • grails-test-suite-web: test excluded 12 class patterns so that execIsolatedTests could run them with forkEvery = 1. The excludes assignment of test-config.gradle (since 26d5c0e, 2025-03-30) replaced the exclusion, so the 9 of those classes that still exist (52 tests) ran in test as well as in execIsolatedTests, and the shared forkEvery has overridden the 1 since a58aa14 (2025-04-18). They have run in the shared JVMs of test since then and pass there, so execIsolatedTests, its list, createCombinedReport, and the forkEvery, maxParallelForks and excludes that test-config.gradle sets anyway go. Three of the patterns matched nothing: GroovyPageAttributesTests is in grails-gsp/grails-taglib now, and GSPResponseWriterSpec and pages/ext/jsp are gone.
  • grails-test-suite-persistence: the three classes it excluded from test and isolated (GrailsDomainBinderTests, ComponentValidationTests, HibernateMappingUniqueConstraintTests) no longer exist, and its testGrailsDomainBinder and testIsolatedPersistentOne tasks were NO-SOURCE, as a Test task registered without testClassesDirs is. Its forkEvery = 25 and local 2 GB heap were overridden. All of it goes.
  • grails-test-suite-uber: isolatedTestsOne named DefaultGrailsControllerClassSpec, which is in grails-core now. Uber filters its isolated classes by name and does not apply test-config.gradle, so its other isolated tasks work as they should.
  • grails-test-report: execIsolatedTests leaves its list of isolated phases.
  • gradle/test-config.gradle adds its excludes with exclude(...) rather than assigning them, so the excludes a module sets before applying it survive.

Verification

  • The effective settings of every Test task in the build (forkEvery, maxParallelForks, heap, excludes, includes and filters), printed before and after the change, differ only in the removed tasks and the removed uber pattern. No other module's excludes were being replaced, so the exclude(...) change leaves every remaining task as it was.
  • :grails-test-suite-web:check, :grails-test-suite-persistence:check and :grails-test-suite-uber:check pass: web 84 classes and 490 tests, persistence 13 and 114, uber's test 122 and 624 and its five isolated tasks 10 and 42.
  • On CI, the Ubuntu JDK 21 job runs the same 11,933 distinct tests as on the base commit 4c1868d, counted from the result lines that test-config.gradle has every test print. It runs 52 fewer test executions, and those are the second runs of the 9 web classes.
  • ./gradlew clean aggregateViolations --continue passes.

#16837 also changes gradle/test-config.gradle and grails-test-suite-uber/build.gradle, on other lines.

…errides

test-config.gradle configures every Test task after the build script that applies it, and it assigned
its excludes, so the excludes a suite had set were replaced. Since 2025-03-30 the classes
grails-test-suite-web isolates have run in its test task as well as in execIsolatedTests, which has
run with the shared forkEvery rather than 1 since 2025-04-18; they pass in the shared JVMs, so the
task, its list and the combined report go. The classes grails-test-suite-persistence excludes and
isolates no longer exist and its two isolated tasks ran nothing; its forkEvery and local heap were
overridden as well. grails-test-suite-uber isolated a spec that has since moved to grails-core.

test-config.gradle now adds its excludes to those of the module.
@matrei matrei added the run ci label Nov 3, 2026
@matrei
matrei marked this pull request as ready for review November 3, 2026 17:20
@codecov

codecov Bot commented Nov 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.0000%. Comparing base (4c1868d) to head (dfa63e7).

Additional details and impacted files

Impacted file tree graph

@@      Coverage Diff       @@
##   8.0.x   #16839   +/-   ##
==============================
==============================
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sbglasius sbglasius left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This an AI assisted review

LGTM. I checked the ordering argument and it holds in both modules:

  • web: the tasks.named('test').configure { … } action was registered before apply from: test-config.gradle. Lazy configure actions run in registration order, so the later configureEach replaced excludes and overrode forkEvery. execIsolatedTests therefore ran classes that test also ran.
  • persistence: test { … } realized the task eagerly, and then the configureEach that apply registered ran immediately on it. That overrode forkEvery, maxHeapSize and excludes. The three excluded classes don't exist anywhere in the tree, and testGrailsDomainBinder / testIsolatedPersistentOne had no testClassesDirs, so they were NO-SOURCE.
  • uber: DefaultGrailsControllerClassSpec now lives only in grails-core/src/test, so the pattern matched nothing.
  • No remaining references to execIsolatedTests, createCombinedReport, testGrailsDomainBinder, testIsolatedPersistentOne or reports/allTests anywhere in the repo, including workflows.

Changing excludes = [...] to exclude(...) is a sensible safeguard, and CI is green.

Two non-blocking nits:

  1. gradle/test-config.gradle: the new comment covers excludes only. The same trap is still there for forkEvery, maxParallelForks and maxHeapSize: a module that sets them before applying the script loses them without any warning, which is how this cleanup became necessary. It could help to say so next to the comment, for example "settings other than excludes must be configured after applying this script". The uber build already has a comment like that.
  2. grails-test-report/build.gradle: the comment above isolatedUnitTestPhases still says "the test-suite projects also run some classes in their own Test tasks". Only grails-test-suite-uber does that now, so you could name it there.

@matrei matrei added the no ci label Nov 4, 2026
test-config.gradle sets maxParallelForks, maxHeapSize and forkEvery over the values a module set
before applying it, so a module that needs its own values sets them after applying it. Only
grails-test-suite-uber still runs classes in Test tasks of its own, so grails-test-report names it.
@testlens-app

testlens-app Bot commented Nov 4, 2026

Copy link
Copy Markdown

🔎 No tests executed 🔎

🏷️ Commit: 4a160f8
▶️ Tests: 0 executed
⚪️ Checks: 49/49 completed


Learn more about TestLens at testlens.app/docs.

@matrei matrei removed the no ci label Nov 4, 2026
@matrei

matrei commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for checking the ordering, @sbglasius. Both nits are addressed in 4a160f8:

  1. gradle/test-config.gradle now says that maxParallelForks, maxHeapSize and forkEvery replace any values a module set before applying the script, and that a module that needs its own values sets them after applying it.
  2. The comment in grails-test-report/build.gradle now names grails-test-suite-uber as the project that runs classes in Test tasks of its own.

The commit changes only comments, so I pushed it without a CI run.

@sbglasius sbglasius left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This an AI assisted review

I found no blocking issues. The analysis in the description checks out against the tree at 4a160f8.

What I checked

  • exclude(...) instead of excludes = [...] in gradle/test-config.gradle. The only build scripts that set Test excludes or forkEvery and also apply test-config.gradle were the web and persistence suites, and this PR removes both. The other modules that set their own values either apply a different config script (grails-data-neo4j/core, grails-test-examples/context-hierarchy, the hibernate dbmigration modules, where the exclude is on jar anyway) or set them after the configure action (grails-test-suite-uber, which doesn't apply test-config.gradle). Switching to exclude(...) doesn't change any remaining task's effective excludes.
  • Web isolated list. 9 of the 12 patterns match a class that still exists in grails-test-suite-web. JSONBindingToNullTests is declared in JSONBindingToNullSpec.groovy, which is why a filename search misses it. GroovyPageAttributesTests is now in grails-gsp/grails-taglib, and GSPResponseWriterSpec and the pages/ext/jsp classes are gone, so those 3 match nothing. This agrees with the description, and those 9 classes have already been running in the shared test forks, so dropping execIsolatedTests doesn't change where any test runs.
  • Persistence. GrailsDomainBinderTests, ComponentValidationTests and HibernateMappingUniqueConstraintTests no longer exist anywhere in the repo. The two registered tasks had no testClassesDirs, so they were NO-SOURCE, as the description says.
  • Uber. DefaultGrailsControllerClassSpec is now in grails-core/src/test/groovy/org/grails/core/, so the isolatedTestsOne entry was dead.
  • Leftover references. Nothing else in the repo, including the workflows and grails-test-report, refers to execIsolatedTests, createCombinedReport, testGrailsDomainBinder, testIsolatedPersistentOne or reports/allTests.

Minor / optional

  • The new comment in test-config.gradle ("A module that needs its own values sets them after applying it") is the important guidance here. It could also say that "after" means a configure action registered later, such as tasks.named('test') { ... } placed below the apply block. Otherwise someone might think a test { } block placed before apply would still win. It doesn't, because the configureEach action runs after it in either case.
  • build-logic/docs-core/build.gradle:139 still uses the excludes = [...] assignment. It's a separate build and nothing is applied before it, so nothing is broken there. It's only mentioned here for consistency, if you want the two to match.
  • If one of the formerly isolated web classes starts polluting static state again, there's no isolation mechanism left in grails-test-suite-web. The uber pattern (a filter.includePatterns task registered after test-config.gradle) would be the way to add one back. That's fine for now given these classes have run in shared forks since early 2025.

LGTM from my side.

@jdaugherty
jdaugherty merged commit 9b6db4f into apache:8.0.x Nov 4, 2026
49 checks passed
@matrei
matrei deleted the build/test-suite-isolation-cleanup branch November 5, 2026 05:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants