Skip to content

[fix][test] Fix flaky PulsarBrokerStatsClientTest.testTopicInternalStats - #24341

Merged
dao-jun merged 2 commits into
apache:masterfrom
hanmz:fix/flaky-test
May 23, 2025
Merged

dao-jun merged 2 commits into
apache:masterfrom
hanmz:fix/flaky-test

Conversation

@hanmz

@hanmz hanmz commented May 22, 2025

Copy link
Copy Markdown

Motivation

Clipboard_Screenshot_1747912362

This unit test assertTrue(cursor.totalNonContiguousDeletedMessagesRange > 0 && (cursor.totalNonContiguousDeletedMessagesRange) < numberOfMsgs / 2) reports an error because the consumer's acknowledge method is implemented one-way and the server may not have processed the ack request yet before topic.getInternalStats , so totalNonContiguousDeletedMessagesRange is sometimes equal to 0.

At the same time, assertFalse(cursor.subscriptionHavePendingRead) sometimes goes wrong unless we close the consumer first.

Modifications

Optimize assert logic to ensure the robustness of unit tests.

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

@github-actions github-actions Bot added the doc-not-needed Your PR changes do not impact docs label May 22, 2025
@dao-jun

dao-jun commented May 23, 2025

Copy link
Copy Markdown
Member

Good job, I tested locally 4 times and it all passed

@codecov-commenter

codecov-commenter commented May 23, 2025 •

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.23%. Comparing base (bbc6224) to head (e62903b).
Report is 1117 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #24341      +/-   ##
============================================
+ Coverage     73.57%   74.23%   +0.65%     
- Complexity    32624    32630       +6     
============================================
  Files          1877     1866      -11     
  Lines        139502   145126    +5624     
  Branches      15299    16593    +1294     
============================================
+ Hits         102638   107733    +5095     
+ Misses        28908    28858      -50     
- Partials       7956     8535     +579     
Flag Coverage Δ
inttests 26.71% <ø> (+2.13%) ⬆️
systests 23.31% <ø> (-1.01%) ⬇️
unittests 73.71% <ø> (+0.86%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 1083 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.

@dao-jun
dao-jun merged commit dc62142 into apache:master May 23, 2025
KannarFr pushed a commit to CleverCloud/pulsar that referenced this pull request Sep 22, 2025
walkinggo pushed a commit to walkinggo/pulsar that referenced this pull request Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-not-needed Your PR changes do not impact docs ready-to-test type/flaky-tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants