Skip to content

fix(java): Stabilize async consumer group test#3697

Open
ryerraguntla wants to merge 3 commits into
apache:masterfrom
ryerraguntla:fix(java-sdk)/3641-flaky-async-consumer-groups
Open

fix(java): Stabilize async consumer group test#3697
ryerraguntla wants to merge 3 commits into
apache:masterfrom
ryerraguntla:fix(java-sdk)/3641-flaky-async-consumer-groups

Conversation

@ryerraguntla

Copy link
Copy Markdown
Contributor

Fixes flakiness in the Java SDK async consumer-group integration test for concurrent join/leave operations. The change adds bounded retry handling for transient not-found errors and waits for the consumer-group membership count to converge before asserting, making the test more stable without changing its intent.

Handle transient IggyResourceNotFoundException during concurrent join/leave operations in AsyncConsumerGroupsTest. This adds bounded retry/backoff helpers and waits for the expected member count before asserting, reducing flakiness from eventually consistent consumer-group state.

Which issue does this PR address?

Closes # 3641
Relates to # pr=3515

Rationale

To address the flaky java tests.

What changed?

This PR stabilizes a flaky Java SDK integration test covering concurrent consumer-group join and leave operations.

The test previously asserted consumer-group state immediately after concurrent operations completed. In some runs, transient IggyResourceNotFoundException errors or short propagation delays caused intermittent failures even though the underlying behavior was correct.

Changes in this PR
add retry handling around concurrent joinConsumerGroup calls
add retry handling around concurrent leaveConsumerGroup calls
retry only for transient IggyResourceNotFoundException cases
wait until the consumer group reaches the expected member count before asserting
extract shared helper methods for retry and polling behavior
add reusable timeout and backoff constants for transient-state handling
Why
Concurrent async operations can briefly observe unstable or not-yet-visible consumer-group state. This PR makes the test robust to those short-lived conditions while preserving the original behavior being verified.

Impact
improves reliability of the Java SDK integration test suite
reduces intermittent failures in consumer-group concurrency coverage
limits scope to test code only
Reviewer-focused summary

Primary goal: eliminate flaky failures in AsyncConsumerGroupsTest
Approach: add bounded retry logic for transient not-found errors and poll for expected membership state
Scope: test-only change in the Java SDK
Risk: low, since production code is unchanged
Behavioral effect: assertions are now based on eventual stable state rather than immediate visibility after concurrent operations

Local Execution

  • Passed
  • Pre-commit hooks ran

AI Usage

If AI tools were used, please answer:

  1. Which tools? Claude
  2. Scope of usage? generated functions and implementation)
  3. How did you verify the generated code works correctly? Manually verified
  4. Can you explain every line of the code if asked? yes

Handle transient `IggyResourceNotFoundException` during concurrent join/leave operations in `AsyncConsumerGroupsTest`. This adds bounded retry/backoff helpers and waits for the expected member count before asserting, reducing flakiness from eventually consistent consumer-group state.
@github-actions

Copy link
Copy Markdown

Thanks for the PR. It is labeled S-waiting-on-review and queued for review.

Slash commands (own line, regular comment) move it around the queue:

  • /ready - back to S-waiting-on-review after addressing feedback
  • /author - flip to S-waiting-on-author while you finish changes
  • /request-review @user-or-team - request a reviewer

See CONTRIBUTING.md for details.

@github-actions github-actions Bot added the S-waiting-on-review PR is waiting on a reviewer label Jul 18, 2026
@ryerraguntla ryerraguntla changed the title fix(java-sdk): Stabilize async consumer group test fix(java): Stabilize async consumer group test Jul 18, 2026
@ryerraguntla

Copy link
Copy Markdown
Contributor Author

/ready

@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.34%. Comparing base (a5001d3) to head (9bda9da).

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #3697   +/-   ##
=========================================
  Coverage     74.34%   74.34%           
  Complexity      950      950           
=========================================
  Files          1303     1303           
  Lines        148712   148712           
  Branches     124225   124224    -1     
=========================================
+ Hits         110562   110565    +3     
  Misses        34673    34673           
+ Partials       3477     3474    -3     
Components Coverage Δ
Rust Core 74.57% <ø> (+<0.01%) ⬆️
Java SDK 62.64% <ø> (ø)
C# SDK 72.28% <ø> (ø)
Python SDK 92.27% <ø> (ø)
PHP SDK 84.52% <ø> (ø)
Node SDK 92.70% <ø> (ø)
Go SDK 43.08% <ø> (ø)
see 10 files with indirect coverage changes
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review PR is waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants