This is an automated email from the ASF dual-hosted git repository.

jamesfredley pushed a commit to branch fix/test-fork-oversubscription
in repository https://gitbox.apache.org/repos/asf/grails-core.git

commit 4ef8cba33f384ab1d3b6558d4385e73cfa08efb2
Author: James Fredley <[email protected]>
AuthorDate: Sat Aug 15 18:49:56 2026 -0400

    build(test): make isolatedTestsTwo actually run serially
    
    The `tasks.named('isolatedTestsTwo', Test)` block set `maxParallelForks = 1`
    and `forkEvery = 100`, but it was registered BEFORE the
    `tasks.withType(Test).configureEach` block in the same script. Gradle runs
    both as deferred configuration actions in registration order at task
    realization, so the later `configureEach` overwrote both values and the task
    ran with `configuredTestParallel` forks instead of one.
    
    Its three test patterns have been deliberately serialized since 2013 because
    they are order sensitive, so running them in parallel risked exactly the 
kind
    of static-state flakiness the suite is isolated to avoid.
    
    Move the override after the `configureEach` block so it wins, and add a
    comment recording the ordering requirement.
    
    CI impact is negligible: the task filters three classes and sharding assigns
    the whole task to a single shard, so `forkEvery = 100` is never reached.
    
    Assisted-by: claude-code:claude-opus-5
---
 grails-test-suite-uber/build.gradle | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/grails-test-suite-uber/build.gradle 
b/grails-test-suite-uber/build.gradle
index 4fc49f517d..375ece5ac8 100644
--- a/grails-test-suite-uber/build.gradle
+++ b/grails-test-suite-uber/build.gradle
@@ -122,11 +122,6 @@ isolatedTestPatterns.keySet().each { taskName ->
     }
 }
 
-tasks.named('isolatedTestsTwo', Test) {
-    maxParallelForks = 1
-    forkEvery = 100
-}
-
 tasks.withType(Test).configureEach {
     // Honor DO_NOT_CACHE_TESTS=1 so developers can repeatedly invoke the same 
test command
     // without --rerun-tasks (and without recompiling everything else).
@@ -141,6 +136,14 @@ tasks.withType(Test).configureEach {
     jvmArgs('--add-opens=java.base/java.lang=ALL-UNNAMED', 
'--add-opens=java.base/java.util=ALL-UNNAMED')
 }
 
+// Must be configured AFTER the tasks.withType(Test) block above. Both are 
deferred
+// configuration actions and Gradle runs them in registration order, so a 
tasks.named
+// block registered first would be silently overwritten by the later 
configureEach.
+tasks.named('isolatedTestsTwo', Test) {
+    maxParallelForks = 1
+    forkEvery = 100
+}
+
 tasks.named('test', Test) {
     // Exclude the isolated tests from the main test task
     filter.excludePatterns = isolatedTestPatterns.values().flatten()

Reply via email to