Skip to content

Keep the Neo4j core test JVMs for the whole test task - #16859

Merged
jdaugherty merged 1 commit into
apache:8.0.xfrom
matrei:build/neo4j-test-fork-reuse
Nov 4, 2026
Merged

jdaugherty merged 1 commit into
apache:8.0.xfrom
matrei:build/neo4j-test-fork-reuse

Conversation

@matrei

@matrei matrei commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Description

grails-data-neo4j-core doesn't apply gradle/test-config.gradle, and its test task restarts the test JVM with forkEvery = 10. Gradle counts forkEvery in the class files it hands to the JUnit Platform, not in the specs the platform runs. test-config.gradle excludes **/*$*.class, but this module doesn't, so its 426 compiled test classes and the 699 classes of the TCK jar, closures, inner classes and domain classes included, each count. On 4 forks, as on CI, the task starts 116 JVMs for the 119 specs that run: 49 of them run no spec, 29 run one, and almost every spec starts in a cold JVM.

This removes the forkEvery, so each fork keeps its JVM for the whole task. #16837 does the same for the modules that apply test-config.gradle.

Verification

  • A probe listener, which is not part of this PR, recorded the live heap after a full GC before each spec. In one JVM that runs all 119 specs (-PmaxTestParallel=1), it grows from 29 MB to at most 214 MB of the module's 1028 MB heap, and the thread count drops back to 16 at the end. With grails-test-listener on the classpath the curve is the same, so this PR doesn't add it: since Release the Introspector's BeanInfo cache after each TCK spec #16834 the TCK specs flush the Introspector's caches in GrailsDataTckManager.cleanupSpec(), and flushing them after the module's own specs too makes no measurable difference.
  • On 4 forks, the tests run for 54 and 55 s instead of 163 and 164 s, from the start of the first spec to the end of the last, in two runs each. The Gradle invocation takes 82 and 83 s instead of 191 and 196 s. These are local numbers, on a 72-thread machine.
  • :grails-data-neo4j-core:check passes with the same 126 classes and 616 tests, 94 of them skipped, as with forkEvery = 10.
  • ./gradlew clean aggregateViolations --continue passes.

The -Xmx1028M stays. The measurements show that a smaller heap would do, but that is a separate change.

Fixes #16856

Gradle counts forkEvery in the class files it hands to the JUnit Platform, not in the specs the
platform runs. The module does not exclude inner and closure classes, so its 426 test class files
and the 699 of the TCK restarted the test JVM about every 10 class files: a run on 4 forks started
116 JVMs for 119 specs, 49 of which ran no spec, and almost every spec ran in a cold JVM. In one
JVM that runs every spec, the live heap peaks at 214 MB of the 1028 MB, with or without
grails-test-listener.
@testlens-app

testlens-app Bot commented Nov 4, 2026

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: 9bf6e60
▶️ Tests: 86829 executed
⚪️ Checks: 94/94 completed


Learn more about TestLens at testlens.app/docs.

@jdaugherty
jdaugherty merged commit 9f7e39d into apache:8.0.x Nov 4, 2026
95 checks passed
@matrei
matrei deleted the build/neo4j-test-fork-reuse 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

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

grails-data-neo4j-core restarts its test JVMs every 10 classes, without the Introspector flush

2 participants