Skip to content

test(gax): use FakeApiClock and RecordingScheduler in ScheduledRetryingExecutorTest - #31

Open
lqiu96 wants to merge 1 commit into
fix/gax-direct-retrying-executor-fake-clock-14625from
fix/gax-scheduled-retrying-executor-fake-clock-13535
Open

lqiu96 wants to merge 1 commit into
fix/gax-direct-retrying-executor-fake-clock-14625from
fix/gax-scheduled-retrying-executor-fake-clock-13535

Conversation

@lqiu96

@lqiu96 lqiu96 commented Oct 20, 2026

Copy link
Copy Markdown
Owner

Summary

This PR is stacked on top of PR googleapis#14705 (branch fix/gax-direct-retrying-executor-fake-clock-14625). It updates ScheduledRetryingExecutorTest to use FakeApiClock and RecordingScheduler, eliminating real-time Thread.sleep and ScheduledThreadPoolExecutor wall-clock delays from retry tests while keeping asynchronous state and cancellation tests untouched.

Changes

  • Refactor RecordingScheduler to extend ScheduledThreadPoolExecutor directly with a single worker thread (CORE_POOL_SIZE = 1), eliminating Mockito dependencies and UnnecessaryStubbingException under MockitoExtension.
  • Add documentation comments to FakeApiClock and RecordingScheduler explaining virtual time advancement, sleep recording, and why zero-delay delegation to a dedicated single worker thread is required to preserve asynchronous callback registration in CallbackChainRetryingFuture.
  • Import java.time.Duration in RecordingScheduler.java and remove fully qualified names.
  • Update ScheduledRetryingExecutorTest with dedicated fakeClock and recordingScheduler fixtures for deterministic retry algorithm tests without touching the shared scheduledExecutorService used by intermediate-state and cancellation tests.

Fixes googleapis#13535

…elpers

Use FakeApiClock and RecordingScheduler in ScheduledRetryingExecutorTest
for deterministic, sleep-free retry tests without modifying existing
asynchronous in-flight test methods.
Refactor RecordingScheduler to extend ScheduledThreadPoolExecutor
directly, eliminating Mockito dependencies and strict-stubbing friction.
Add Javadoc documentation for FakeApiClock and RecordingScheduler.

Fixes googleapis#13535
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