Skip to content

[fix][test] Fix flaky ReplicatorRateLimiterTest.testReplicatorRateLimiterMessageReceivedAllMessages#25340

Merged
lhotari merged 2 commits intoapache:masterfrom
merlimat:fix/flaky-testReplicatorRateLimiter
Mar 19, 2026
Merged

[fix][test] Fix flaky ReplicatorRateLimiterTest.testReplicatorRateLimiterMessageReceivedAllMessages#25340
lhotari merged 2 commits intoapache:masterfrom
merlimat:fix/flaky-testReplicatorRateLimiter

Conversation

@merlimat
Copy link
Copy Markdown
Contributor

@merlimat merlimat commented Mar 17, 2026

Flaky test failure

org.awaitility.core.ConditionTimeoutException: Assertion condition expected [100] but found [105] within 10 seconds.
	at org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:167)
	at org.awaitility.core.AssertionCondition.await(AssertionCondition.java:119)
	at org.awaitility.core.AssertionCondition.await(AssertionCondition.java:31)
	at org.awaitility.core.ConditionFactory.until(ConditionFactory.java:985)
	at org.awaitility.core.ConditionFactory.untilAsserted(ConditionFactory.java:769)
	at org.apache.pulsar.broker.service.ReplicatorRateLimiterTest.testReplicatorRateLimiterMessageReceivedAllMessages(ReplicatorRateLimiterTest.java:534)

Summary

  • Fix flaky testReplicatorRateLimiterMessageReceivedAllMessages which asserts an exact message count (assertEquals(totalReceived, 100)) but the AsyncTokenBucket rate limiter can allow a small number of extra messages (e.g. 105) before throttling kicks in.
  • Changed the assertion to verify the rate limiter is effective: received at least the rate limit but not all 250 published messages.

Documentation

  • doc-not-needed
    (Your PR doesn't need any doc update)

Matching PR in forked repository

No response

Tip

Add the labels ready-to-test and area/test to trigger the CI.

…iterMessageReceivedAllMessages

The AsyncTokenBucket rate limiter is not perfectly precise and can
allow a small number of extra messages beyond the configured limit
before throttling kicks in. Changed the assertion from requiring
an exact count to verifying the rate limiter is effective (received
at least the rate limit but not all messages).
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Mar 17, 2026
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.72%. Comparing base (be87cd9) to head (aa20f88).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##             master   #25340       +/-   ##
=============================================
+ Coverage     37.37%   72.72%   +35.34%     
- Complexity    13188    33853    +20665     
=============================================
  Files          1897     1954       +57     
  Lines        150557   154745     +4188     
  Branches      17215    17709      +494     
=============================================
+ Hits          56276   112538    +56262     
+ Misses        86612    33169    -53443     
- Partials       7669     9038     +1369     
Flag Coverage Δ
inttests 25.75% <ø> (-0.04%) ⬇️
systests 22.48% <ø> (+<0.01%) ⬆️
unittests 73.70% <ø> (+39.55%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 1415 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.

@lhotari lhotari merged commit a1b1a9e into apache:master Mar 19, 2026
103 of 105 checks passed
@lhotari lhotari added this to the 4.2.0 milestone Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/test doc-not-needed Your PR changes do not impact docs ready-to-test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants