Skip to content

Make no-JHDF tests opt-in - #4467

Open
Darlokt wants to merge 1 commit into
ome:developfrom
Darlokt:fix-no-hdf-suite-default-include
Open

Make no-JHDF tests opt-in#4467
Darlokt wants to merge 1 commit into
ome:developfrom
Darlokt:fix-no-hdf-suite-default-include

Conversation

@Darlokt

@Darlokt Darlokt commented Aug 5, 2026

Copy link
Copy Markdown

Hej,

While investigating the MemoizerTest failures mentioned in #4464, I found that the problem was caused by the Maven test configuration rather than a problem in the normal Memoizer tests.

formats-bsd had two Surefire executions in the default lifecycle: the regular suite and a second execution with JHDF removed from the classpath. When -Dtest=MemoizerTest was used, Surefire applied that filter to both executions, so Memoizer tests were unexpectedly run without JHDF.

The normal tests passed with JHDF available. On the stripped classpath, the default Memoizer creates an ImageReader, which eagerly instantiates all registered readers, including HDF readers. Kryo then inspected the complete reader graph and attempted to resolve HDF5CompoundDataMap, causing memo serialization to fail. saveMemo() caught the failure and returned false, producing the two reported assertion failures.

As far as I can tell the no-JHDF suite was originally intended only to verify that JHDF service discovery fails cleanly when the dependency is absent, but not intended to run arbitrary tests without JHDF.

Changes

Move the no-JHDF compatibility test into an explicit no-jhdf Maven profile.

The changes:

  • Remove the dependency-excluded Surefire execution from the default Maven lifecycle.
  • Add the execution under the explicit no-jhdf profile.
  • Remove test-no-jhdf from the default Ant test target while retaining the explicit Ant target.
  • Update Maven CI to run mvn install -Pno-jhdf, preserving coverage of both the normal and missing-JHDF suites.
  • Keep the existing MissingJHDFServiceTest unchanged.
  • Prevent focused normal tests from unexpectedly running on a dependency-excluded classpath.

This change does not alter Memoizer serialization or claim to add Memoizer support for missing JHDF. It isolates the existing compatibility test and makes the test contract explicit. It mostly improves dev experience.

The serializer should still be hardened separately. Even with the no-JHDF suite isolated, users running Bio-Formats without optional HDF dependencies or similar can still lose memoization for otherwise supported non-HDF etc. files because Kryo serializes the entire eagerly discovered ImageReader graph. Unused HDF readers should not make an unrelated memo fail. A future fix should serialize only the active reader and wrapper chain, reconstruct discovery from the current runtime classpath, record or validate required optional dependencies, bump the memo format version, and report unsupported memoization clearly instead of silently returning false. No matter if the separate no-JHDF suite is still needed, this is a central problem with the memoizer.

Move the dependency-excluded JHDF service test into an explicit Maven profile and
remove it from the default Ant test target. Keep CI coverage by running the
profile in Maven builds while preventing focused normal tests from inheriting
the stripped classpath.
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.

1 participant