[improve][test] Fix flaky test SimpleProducerConsumerStatTest#testMsgRateExpired - #20629
Merged
Conversation
Technoboy-
reviewed
Jun 27, 2023
| Awaitility.await().ignoreExceptions().timeout(10, TimeUnit.SECONDS) | ||
| .until(() -> pulsar.getBrokerService().getTopicStats().get(topicName).getSubscriptions().get(subName).getTotalMsgExpired() > 0); | ||
|
|
||
| Thread.sleep(2000); |
Contributor
There was a problem hiding this comment.
We can remove this sleep
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #20629 +/- ##
=============================================
+ Coverage 33.58% 73.07% +39.48%
+ Complexity 12127 3701 -8426
=============================================
Files 1613 1867 +254
Lines 126241 138684 +12443
Branches 13770 15240 +1470
=============================================
+ Hits 42396 101338 +58942
+ Misses 78331 29310 -49021
- Partials 5514 8036 +2522
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
4 tasks
BewareMyPower
approved these changes
Jun 30, 2023
nodece
pushed a commit
to nodece/pulsar
that referenced
this pull request
Jun 20, 2025
…RateExpired (apache#20629) (cherry picked from commit 9526382)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #20615
Motivation
SimpleProducerConsumerStatTest#testMsgRateExpiredseems flakey, so I'll try to improve it.Modifications
Before this fix, we checked if the messages expired by referring to the
msgRateExpiredvalue in the subscription stats. However, this value resets to 0 over time, so we instead refer to thetotalMsgExpiredvalue, which never resets.Additionally, we get the stats directly from the instances in the broker server and not from the admin API.
Verifying this change
Documentation
docdoc-requireddoc-not-neededdoc-complete