-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[improve][test] Fix flaky test SimpleProducerConsumerStatTest#testMsgRateExpired #20629
Conversation
Awaitility.await().ignoreExceptions().timeout(5, TimeUnit.SECONDS) | ||
.until(() -> admin.topics().getStats(topicName).getSubscriptions().get(subName).getMsgRateExpired() > 0.001); | ||
Awaitility.await().ignoreExceptions().timeout(10, TimeUnit.SECONDS) | ||
.until(() -> pulsar.getBrokerService().getTopicStats().get(topicName).getSubscriptions().get(subName).getTotalMsgExpired() > 0); | ||
|
||
Thread.sleep(2000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove this sleep
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Technoboy- Removed. Thanks.
Codecov Report
@@ 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.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Fixes #20615
Motivation
SimpleProducerConsumerStatTest#testMsgRateExpired
seems flakey, so I'll try to improve it.Modifications
Before this fix, we checked if the messages expired by referring to the
msgRateExpired
value in the subscription stats. However, this value resets to 0 over time, so we instead refer to thetotalMsgExpired
value, 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
doc
doc-required
doc-not-needed
doc-complete