Skip to content

llm-inference/gemma: three tests use JUnit 4 Assume under the Jupiter engine — aborts record as failures #261

Description

@michalharakal

Summary

Three tests in llm-inference/gemma import JUnit 4's org.junit.Assume.assumeTrue while the module runs under the JUnit 5 Jupiter engine. JUnit 4's AssumptionViolatedException is not an org.opentest4j.TestAbortedException, so Jupiter records an unmet assumption as a FAILURE rather than a skip.

Affected

  • llm-inference/gemma/src/jvmTest/kotlin/sk/ainet/models/gemma/Gemma4SafeTensorsIntegrationTest.kt:4
  • llm-inference/gemma/src/jvmTest/kotlin/sk/ainet/models/gemma/GemmaNetworkLoaderIntegrationTest.kt:4
  • llm-inference/gemma/src/jvmTest/kotlin/sk/ainet/models/gemma/Gemma3nSafeTensorsIntegrationTest.kt:4

All three: import org.junit.Assume.assumeTrue.

llm-inference/gemma/build.gradle.kts:67 puts JUnit 4 on the jvmTest classpath (implementation(libs.junit)), which is why this compiles. There is no junit-vintage-engine on the classpath, so the Jupiter engine is the one interpreting the exception.

Why it has not bitten yet

All three are @Tag("integration"), and the root build.gradle.kts applies useJUnitPlatform { excludeTags("integration") } unless -PincludeIntegration is passed. So CI never runs them. Anyone running with -PincludeIntegration on a machine lacking the checkpoints would see failures where skips were intended.

Correct pattern, already used in the same module

llm-inference/gemma/src/jvmTest/kotlin/sk/ainet/models/gemma/GemmaQ5KPackedParityTest.kt:9,71 uses org.junit.jupiter.api.Assumptions correctly. Same for llm-runtime/kgemma/.../Gemma4ReferenceSmokeTest.kt:10 and, as of PR #259, llm-runtime/kgemma/.../FunctionGemmaFixture.kt.

Fix

Swap the import to org.junit.jupiter.api.Assumptions.assumeTrue in the three files. Then consider dropping implementation(libs.junit) from llm-inference/gemma/build.gradle.kts:67 if nothing else needs JUnit 4 — that would make the mistake unrepresentable in this module, as it already is in kgemma.

Verification: run the three with -PincludeIntegration and no checkpoints present; each <testcase> in build/test-results/jvmTest/TEST-*.xml should carry a <skipped/> child with type="org.opentest4j.TestAbortedException", not a <failure>.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions