Skip to content

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

Merged
reta merged 1 commit into
opensearch-project:mainfrom
loggk:fix/model-test-both-mappers
Aug 9, 2026
Merged

Run model tests against both JSON mappers instead of picking one at r…#2085
reta merged 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>

@reta reta left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @loggk !

@reta
reta merged commit be98f80 into opensearch-project:main Aug 9, 2026
54 checks passed
reta pushed a commit that referenced this pull request Aug 9, 2026
…andom (#2085) (#2089)

(cherry picked from commit be98f80)

Signed-off-by: Logan Kennedy <kennedylogan22@gmail.com>
Signed-off-by: opensearch-ci-bot <opensearch-infra@amazon.com>
Co-authored-by: Logan Kennedy <163435909+loggk@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[PROPOSAL] ModelTestCase.mapper improvements

2 participants