Skip to content

Migrate Chronicle Map tests to JUnit 5 - #588

Merged
peter-lawrey merged 18 commits into
developfrom
feature/junit5
Sep 17, 2026
Merged

peter-lawrey merged 18 commits into
developfrom
feature/junit5

Conversation

@peter-lawrey

@peter-lawrey peter-lawrey commented Mar 24, 2026

Copy link
Copy Markdown
Member

Migrate Chronicle Map tests and shared fixtures to Jupiter while retaining execution of the remaining JUnit 4 tests. Conditional removal has a real map-owning regression; nested-context and worker-write assertions target the intended operations and cannot pass because setup failed or a future timed out.

Current source: 59e6a00fdeaa890230c0cac01ac65ee5e0ce8567. It contains develop ec649062438ef6f706a493945608d44dbb3df3dc and the updated #617 prerequisite at 505a7b507b6e8744024705c66e127f1ac324cf64. Land that independently useful repair separately, then inspect the migration's remaining diff. This branch as a whole still contains the shared production repair.

The production audit found that only VanillaChronicleHash changes behaviour relative to develop. Changes in InternalMapFileAnalyzer, MapFileAnalyzer and ChronicleMapBuilder are formatting. The shared close repair now has //! blocks explaining every behavioural region and referencing seven regressions. This review changes no production tokens beyond comments and whitespace.

The migration retains:

  • Matching and non-matching conditional removal checks in testRemove2, with the owning map closed.
  • Narrow nested-removal assertions and an ExecutionException caused specifically by InterProcessDeadLockException for the worker write. Context release precedes bounded worker termination and map close; secondary cleanup failures remain attached to the original assertion.
  • Strict temporary-directory cleanup, memory-release assertions and the embedded JUnit 4 worker-failure adapters.
  • Both map modes, eight memory-lifecycle combinations, six alignment layouts and five startup repetitions.

The review added three Jupiter CloseContextSnapshotTest cases inherited from #617's JUnit 4 regressions. They cover absent resources, released/collected context slots and cleared holders. Each fails when its corresponding guard is removed. The four persisted query/iteration regressions fail with develop's old production file and pass with the repair.

It also fixed an existing fixture leak in MapCloseTest.vanillaChronicleHashAllContextsExpungeTest: the final query and owning map now close in order. A probe against the original fixture found one open map and one active context after a passing invocation; the corrected fixture leaves neither. The final validation runs required no forced JVM shutdown.

Fresh validation on Linux x86_64, Maven 3.9.11, isolated dependency cache, zero retries:

Check Result
OpenJDK 21.0.12 full clean verify 1,333 reported cases, 82 skips, zero failures/errors; Checkstyle, packaging and binary compatibility passed
OpenJDK 8u502 affected close/context group 14 cases passed, zero failures/errors/skips
Full-run selected groups 94 map-mode invocations, 16 memory-lifecycle invocations, 12 alignment invocations, five startup repetitions and all eight legacy worker-failure variants passed
Shared production controls Four old-production failures and three individual null-guard failures; candidate controls passed

The full-run total increases from the previous 1,330 by the three new snapshot regressions. Jupiter executes the new tests and Vintage executes the eight legacy worker-failure variants. The September 12 scenario-level qualification remains a historical comparison at its stated revisions. This review did not rebuild that complete discovery/parameter manifest, so the fresh total alone is not a new parity proof.

Reproduction, using a populated isolated Maven cache:

# JDK 21
mvn -o -Dmaven.repo.local="$MAP_REVIEW_CACHE" \
  -Dsurefire.rerunFailingTestsCount=0 clean verify

# JDK 8
mvn -o -Dmaven.repo.local="$MAP_REVIEW_CACHE" \
  -Dsurefire.rerunFailingTestsCount=0 \
  -Dtest=CloseInContextResourceTest,CloseContextSnapshotTest,MapCloseTest \
  clean test

Authenticated TeamCity review at 15:03 UTC on 17 September: eight builds on this exact head have finished successfully (Linux ARM, Java 8/11/17/21/25 and Zing 8/11); macOS build 1363098 remains queued. Linux Java 8 build 1363094 completed the full suite: 1,333 cases, 82 skips, zero failures/errors.

Windows qualification failed. Build 1363101 finished with BUILD FAILURE and process exit 1, reporting three failures in five ParallelStartupTest repetitions. Worker map creation failed with sizeWord is not ready: 0, an impossible header size (446921713 versus a 65536-byte file), and a header-checksum mismatch; the owning assertion observed 15, 15 and 1 successful workers instead of 16. TeamCity groups these under one test identity. Surefire lists all five runs (three failures, two passes) under that method; its final aggregate is 1,329 results, one failure and 75 skips. The four persisted-close and three snapshot regressions passed. The startup algorithm and five-repetition annotation are unchanged from #617, whose Windows run passed; causation by the migration has not been established. A controlled Windows comparison with matching dependencies is needed before changing startup behaviour or weakening this test.

The earlier Windows/macOS failure statuses correspond to cancelled builds. The old Java 26/27 failures are now diagnosed: JSR166TestCase.java:273 calls Thread.stop(), so testCompile fails with cannot find symbol: method stop(). The same call remains in this head and develop. JDK 26 removed that API; this is an outstanding test-fixture compatibility issue. Compiler diagnostics were recovered from retained TeamCity artifacts after normal old-log download endpoints returned 404. No new Java 26/27 execution is established for this head.

The existing relocation boundary remains: a new entry can be published before write-lock acquisition, so lock rejection does not establish transactional rollback. The separate other-thread close-timeout path also remains outside #617's same-thread rejection repair. No merge approval is recorded by this update.

@sonarqubecloud

Copy link
Copy Markdown

# Conflicts:
#	src/test/java/net/openhft/chronicle/map/AbstractMarshallableKeyValueTest.java
#	src/test/java/net/openhft/chronicle/map/AutoResizeTest.java
#	src/test/java/net/openhft/chronicle/map/BooleanValuesTest.java
#	src/test/java/net/openhft/chronicle/map/BuildVersionTest.java
#	src/test/java/net/openhft/chronicle/map/BytesMarshallableValueTest.java
#	src/test/java/net/openhft/chronicle/map/CHMUseCasesTest.java
#	src/test/java/net/openhft/chronicle/map/ChronicleMapEqualsTest.java
#	src/test/java/net/openhft/chronicle/map/ChronicleMapImportExportTest.java
#	src/test/java/net/openhft/chronicle/map/ChronicleMapSanityCheckTest.java
#	src/test/java/net/openhft/chronicle/map/ChronicleMapTest.java
#	src/test/java/net/openhft/chronicle/map/ConstantSizeBySampleTest.java
#	src/test/java/net/openhft/chronicle/map/DefaultValueTest.java
#	src/test/java/net/openhft/chronicle/map/DemoChronicleMapTest.java
#	src/test/java/net/openhft/chronicle/map/ExitHookTest.java
#	src/test/java/net/openhft/chronicle/map/IntValueMapTest.java
#	src/test/java/net/openhft/chronicle/map/Issue354bTest.java
#	src/test/java/net/openhft/chronicle/map/Issue42Test.java
#	src/test/java/net/openhft/chronicle/map/Issue43Test.java
#	src/test/java/net/openhft/chronicle/map/Issue60Test.java
#	src/test/java/net/openhft/chronicle/map/LargeEntriesTest.java
#	src/test/java/net/openhft/chronicle/map/ListenersTest.java
#	src/test/java/net/openhft/chronicle/map/MapCloseTest.java
#	src/test/java/net/openhft/chronicle/map/MarkTest.java
#	src/test/java/net/openhft/chronicle/map/MarshallableReaderWriterTest.java
#	src/test/java/net/openhft/chronicle/map/MemoryLeaksTest.java
#	src/test/java/net/openhft/chronicle/map/NestedContextsTest.java
#	src/test/java/net/openhft/chronicle/map/RecursiveRefereneChMapTest.java
#	src/test/java/net/openhft/chronicle/map/ReplicatedChronicleMapTest.java
#	src/test/java/net/openhft/chronicle/map/TrickyContextCasesTest.java
#	src/test/java/net/openhft/chronicle/map/ValueAlignmentRelocationTest.java
#	src/test/java/net/openhft/chronicle/map/fromdocs/OpenJDKAndHashMapExamplesTest.java
#	src/test/java/net/openhft/chronicle/map/fromdocs/acid/revelations/DirtyReadVictimTest.java
#	src/test/java/net/openhft/chronicle/map/issue/ParallelStartupTest.java
#	src/test/java/net/openhft/chronicle/map/issue/PutIfAbsentNoGarbageTest.java
#	src/test/java/net/openhft/chronicle/map/jsr166/JSR166TestCase.java
#	src/test/java/net/openhft/chronicle/map/jsr166/map/ChronicleMapTest.java
#	src/test/java/net/openhft/chronicle/map/locks/DirtyReadOffenderIPCTest.java
#	src/test/java/net/openhft/chronicle/map/locks/DirtyReadOffenderTest.java
#	src/test/java/net/openhft/chronicle/map/locks/DirtyReadOffender_ReaderWriterTest.java
#	src/test/java/net/openhft/chronicle/map/locks/DirtyReadOffender_WriterReaderTest.java
#	src/test/java/net/openhft/chronicle/map/locks/DirtyReadOffender_WriterWriterTest.java
#	src/test/java/net/openhft/chronicle/map/locks/DirtyReadVictimIPCTest.java
#	src/test/java/net/openhft/chronicle/map/locks/DirtyReadVictimTest.java
#	src/test/java/net/openhft/chronicle/map/locks/ReaderToo.java
#	src/test/java/net/openhft/chronicle/map/locks/WriterToo.java
#	src/test/java/net/openhft/chronicle/set/Issue3Test.java
@peter-lawrey
peter-lawrey requested a review from tgd June 1, 2026 15:26
@sonarqubecloud

sonarqubecloud Bot commented Jun 1, 2026

Copy link
Copy Markdown

@tgd
tgd removed their request for review August 26, 2026 18:01
peter-lawrey added a commit that referenced this pull request Sep 8, 2026
Use Buffer-typed cursor calls so modern source/target-8 compilation does not link Map header I/O against Java 9+ ByteBuffer methods. Include the global-state flip required by reopening, exposed by exercising the packaged artifact on Java 8.

Extract the compatibility changes identified in #588 and add create/reopen/recover/reopen coverage. The Java-21-built baseline fails on Java 8; the corrected packaged JAR passes, as does full Java 21 verification.
peter-lawrey added a commit that referenced this pull request Sep 8, 2026
* Require successful initial opening in the recovery test

Extract the scoped recovery assertion identified in #588. Initial opening and cleanup failures must fail independently; close any Map unexpectedly returned by recovery outside assertThrows.

* Simplify cleanup of unexpected recovery results

Use Closeable.closeQuietly for the nullable recovery result, keeping cleanup outside the scoped assertion. Addresses review feedback on PR #614.
peter-lawrey added a commit that referenced this pull request Sep 8, 2026
* Record JUnit assertion failures from JSR166 worker helpers

Catch the AssertionError thrown by JUnit 4, record it for teardown, and preserve the original worker throwable. Extract the helper correction identified in #588 without translating the shared fixture or its consumers.

An owning-JUnit regression fails six of eight cases before the fix; all eight pass afterwards. No active pre-existing consumer of the affected worker helpers was found.

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Preserve the existing branch history and use the reviewed conflict
resolution from 4f3d57351c2498024eb664335552ee1f0a0b1fa5.
The resulting tree is identical to that validated candidate.
@sonarqubecloud

Copy link
Copy Markdown

@peter-lawrey
peter-lawrey merged commit 7b6027b into develop Sep 17, 2026
9 of 11 checks passed
@peter-lawrey
peter-lawrey deleted the feature/junit5 branch September 17, 2026 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants