Add deterministic CAS retry tests for ExhaustedDataLoaderDispatchStrategy by andimarek · Pull Request #4329 · graphql-java/graphql-java · GitHub
Skip to content

Add deterministic CAS retry tests for ExhaustedDataLoaderDispatchStrategy#4329

Merged
andimarek merged 2 commits intomasterfrom
fix/deterministic-dispatch-strategy-coverage
Mar 10, 2026
Merged

Add deterministic CAS retry tests for ExhaustedDataLoaderDispatchStrategy#4329
andimarek merged 2 commits intomasterfrom
fix/deterministic-dispatch-strategy-coverage

Conversation

@andimarek
Copy link
Copy Markdown
Member

Summary

  • The per-class coverage gate was flaking on ExhaustedDataLoaderDispatchStrategy.dispatchImpl because its CAS retry branches only execute under real thread contention, making coverage non-deterministic (see PR Change Dependabot update schedule from weekly to monthly #4326 for an example)
  • Adds a ContendedCallStack test subclass that selectively injects CAS failures targeting specific state transitions, deterministically exercising both retry paths without relying on thread scheduling
  • Makes CallStack inner class package-private and adds a @VisibleForTesting constructor to support test injection — no behavioral changes to production code

Test plan

  • All 10 ExhaustedDataLoaderDispatchStrategyTest tests pass
  • JaCoCo confirms 100% line, branch, instruction, and method coverage on dispatchImpl and ExhaustedDataLoaderDispatchStrategy overall
  • CI coverage gate should no longer flake on this class

🤖 Generated with Claude Code

andi and others added 2 commits March 11, 2026 09:14
…tegy

The coverage gate was flaking on dispatchImpl's CAS retry branches because
they only execute under real thread contention, making coverage
non-deterministic. This adds targeted tests that inject simulated CAS
failures to deterministically exercise both retry paths (dispatch-setup
and early-exit) without relying on thread scheduling.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 10, 2026

@andimarek andimarek merged commit a3ff5aa into master Mar 10, 2026
11 checks passed
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