Skip to content

test(showcase): add integration tests for retries - #13929

Open
nnicolee wants to merge 10 commits into
mainfrom
test/showcase-retries
Open

test(showcase): add integration tests for retries#13929
nnicolee wants to merge 10 commits into
mainfrom
test/showcase-retries

Conversation

@nnicolee

@nnicolee nnicolee commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Description

This PR expands E2E retry integration tests verifying that client-side retry attempts adhere to configured retry settings and timeout limits across both gRPC and HTTP/JSON transports.

Key Changes

  • SequenceService Client Configuration:
    • Uses client initializer methods in TestClientInitializer for creating SequenceServiceClient instances configured with custom retry parameters and disabled jitter.
  • Expanded Test Coverage:
    • Exponential Backoff: Tests recovery across a standard error sequence (UNAVAILABLE -> UNAVAILABLE -> UNAVAILABLE -> OK).
    • No-Retry Config (maxAttempts = 1): Verifies that single-attempt settings abort immediately on the first error.
    • Non-Retryable Error: Verifies that non-retryable status codes (INVALID_ARGUMENT) halt retries immediately even when maxAttempts > 1.
    • Multiple Retryable Codes: Verifies retrying through a sequence of different retryable status codes (UNAVAILABLE -> RESOURCE_EXHAUSTED -> DEADLINE_EXCEEDED -> OK).
    • RPC Timeout Retries (rpcTimeout): Verifies that attempt timeouts cancel individual calls and trigger retries when server delay exceeds the attempt deadline.
    • Total Timeout Enforcement (totalTimeout): Verifies that cumulative operation deadlines terminate the retry loop with DEADLINE_EXCEEDED when total time expires.
  • Flake-Free Verification:
    • Uses the mock server's stateful SequenceService report polled via Awaitility to verify attempt counts and status code sequences, removing local CPU context-switching scheduling lag as a source of test flakiness.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces integration tests for verifying exponential backoff retries on both gRPC and HTTP/JSON clients using the SequenceServiceClient. It also adds corresponding helper methods in TestClientInitializer to initialize these clients with custom retry settings. The feedback suggests simplifying the helper methods in TestClientInitializer by configuring SequenceServiceSettings.Builder directly, which avoids intermediate stub settings and unnecessary object allocations.

@nnicolee
nnicolee marked this pull request as ready for review July 28, 2026 18:42
@nnicolee
nnicolee requested review from a team as code owners July 28, 2026 18:42
@nnicolee
nnicolee requested a review from lqiu96 July 28, 2026 18:43
@nnicolee nnicolee changed the title test(showcase): add integration tests for exponential backoff retries using SequenceService test(showcase): add integration tests for retries Jul 29, 2026
@nnicolee

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces integration tests for retry logic (ITRetries.java) across both gRPC and HTTP/JSON clients, covering scenarios such as exponential backoff, no retry, non-retryable errors, multiple status codes, and timeouts. It also adds helper methods in TestClientInitializer.java to initialize SequenceServiceClient instances with custom retry settings. The review feedback suggests improving code readability by removing redundant fully qualified class names (like com.google.rpc.Code and java.time.Duration) since these classes are already imported.

@nnicolee

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces integration tests for retry logic in ITRetries.java using both gRPC and HTTP/JSON clients, alongside helper methods in TestClientInitializer.java to initialize these clients with custom retry settings. The review feedback focuses on ensuring exception-safe resource management during client setup and teardown in the test class to prevent potential resource leaks, as well as removing redundant @SuppressWarnings("deprecation") annotations from the test methods.

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.

2 participants