Skip to content

Run model tests against both JSON mappers instead of picking one at r… - #2085

Open
loggk wants to merge 1 commit into
opensearch-project:mainfrom
loggk:fix/model-test-both-mappers
Open

Run model tests against both JSON mappers instead of picking one at r…#2085
loggk wants to merge 1 commit into
opensearch-project:mainfrom
loggk:fix/model-test-both-mappers

Conversation

@loggk

@loggk loggk commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Description

ModelTestCase chooses between JsonbJsonpMapper and JacksonJsonpMapper with a single Random coin flip per JVM, so each test run exercises one serialization backend and never the other, chosen at random. A bug affecting only one mapper passes CI about half the time.

Changes

  • Replace the random mapper selection in ModelTestCase with JUnit 4 Parameterized, running every test against both mappers. @RunWith is inherited and the mapper is injected by field, so none of the 104 subclasses need changes.

Verified with ./gradlew :java-client:unitTest: 426 tests become 604, with exactly 178 per mapper and 0 failures. Runs are now deterministic, and failures report which mapper broke (testName[json-b] / testName[jackson]). spotlessJavaCheck passes.

Issues Resolved

Resolves #770

Check List

  • All tests pass
  • Commits are signed per the DCO using --signoff
  • Changelog updated

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

…andom

Signed-off-by: Logan Kennedy <kennedylogan22@gmail.com>
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.

[PROPOSAL] ModelTestCase.mapper improvements

1 participant