You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add deterministic CAS retry tests for ExhaustedDataLoaderDispatchStrategy
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>
Copy file name to clipboardExpand all lines: src/test/groovy/graphql/execution/instrumentation/dataloader/ExhaustedDataLoaderDispatchStrategyTest.groovy
+132Lines changed: 132 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -298,4 +298,136 @@ class ExhaustedDataLoaderDispatchStrategyTest extends Specification {
298
298
// The deferred call stack dispatches independently
299
299
batchLoaderInvocations.get() ==1
300
300
}
301
+
302
+
/**
303
+
* A CallStack subclass that forces CAS failures to deterministically exercise
304
+
* the retry paths in dispatchImpl's CAS loop. Without this, CAS retries only
305
+
* happen under real thread contention, making coverage non-deterministic.
306
+
*
307
+
* Failures are targeted: only CAS attempts matching a specific state transition
308
+
* (identified by the newState pattern) are failed, so other CAS users like
309
+
* incrementObjectRunningCount/decrementObjectRunningCount are not affected.
0 commit comments