test(showcase): Add gRPC and HttpJson Showcase ITs to verify Retries - #13929
test(showcase): Add gRPC and HttpJson Showcase ITs to verify Retries#13929nnicolee wants to merge 13 commits into
Conversation
… using SequenceService
There was a problem hiding this comment.
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.
…est/showcase-retries
…rviceSettings.Builder directly
|
/gemini review |
There was a problem hiding this comment.
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.
|
/gemini review |
There was a problem hiding this comment.
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.
b670b7d to
c0cbe21
Compare
| return builder.build(); | ||
| } | ||
|
|
||
| private SequenceReport getSequenceReport( |
There was a problem hiding this comment.
qq, we need the expectedAttempts param here because it's possible that getSequenceReport RPC result doesn't have all the sequences yet? I assume it's for calls where we do a deadline_exceed test (make the tests run longer)
There was a problem hiding this comment.
Yes! We have expectedAttempts because retry attempts are logged asynchronously on the showcase server as RPC calls occur, so expected attempts tells Awaitility to poll getSequenceReport until the server logged at least expectedAttempts (which prevents race conditions)
| List<SequenceReport.Attempt> attempts = report.getAttemptsList(); | ||
| assertThat(attempts).hasSize(1); | ||
| assertThat(attempts.get(0).getStatus().getCode()).isEqualTo(Code.UNAVAILABLE.getNumber()); | ||
| assertThat(Durations.toMillis(attempts.get(0).getAttemptDelay())).isAtLeast(0L); |
There was a problem hiding this comment.
qq, should this be isAtLeast(1) to assert that there was a delay?
There was a problem hiding this comment.
This test is verifying noRetry (only 1 attempt), the initial attempt should execute immediately with no delay. We can remove this assertion since it's not necessary since there's only one attempt!
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
TestClientInitializerfor creatingSequenceServiceClientinstances configured with custom retry parameters and disabled jitter.UNAVAILABLE->UNAVAILABLE->UNAVAILABLE->OK).maxAttempts = 1): Verifies that single-attempt settings abort immediately on the first error.INVALID_ARGUMENT) halt retries immediately even whenmaxAttempts > 1.UNAVAILABLE->RESOURCE_EXHAUSTED->DEADLINE_EXCEEDED->OK).rpcTimeout): Verifies that attempt timeouts cancel individual calls and trigger retries when server delay exceeds the attempt deadline.totalTimeout): Verifies that cumulative operation deadlines terminate the retry loop withDEADLINE_EXCEEDEDwhen total time expires.SequenceServicereport polled via Awaitility to verify attempt counts and status code sequences, removing local CPU context-switching scheduling lag as a source of test flakiness.