Skip to content

[fix][test] Fix flaky PersistentTopicTest.testBacklogCursor#25348

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

[fix][test] Fix flaky PersistentTopicTest.testBacklogCursor#25348
lhotari merged 2 commits intoapache:masterfrom
merlimat:fix/flaky-PersistentTopicTest-backlogCursor

Conversation

@merlimat
Copy link
Copy Markdown
Contributor

@merlimat merlimat commented Mar 18, 2026

Flaky test failure

java.lang.AssertionError: expected [false] but found [true]
	at org.testng.Assert.fail(Assert.java:110)
	at org.testng.Assert.failNotEquals(Assert.java:1577)
	at org.testng.Assert.assertFalse(Assert.java:78)
	at org.testng.Assert.assertFalse(Assert.java:88)
	at org.apache.pulsar.broker.service.PersistentTopicTest.testBacklogCursor(PersistentTopicTest.java:2019)

Summary

  • Fix flaky PersistentTopicTest.testBacklogCursor which expects checkBackloggedCursors() to deactivate cursors with backlog exceeding the threshold.
  • The ManagedLedgerConfig default has cacheEvictionByExpectedReadCount=true, which causes checkBackloggedCursor() to return early without processing any cursors. The test was passing only when a previous test happened to change this flag.
  • Set cacheEvictionByExpectedReadCount=false on the ledger config so that backlog-based cursor deactivation is actually exercised.

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.

The test expects checkBackloggedCursors() to deactivate cursors
with backlog exceeding the threshold. However, the ManagedLedgerConfig
default has cacheEvictionByExpectedReadCount=true, which causes
checkBackloggedCursor() to return early without processing any
cursors. Set cacheEvictionByExpectedReadCount=false on the ledger
config so that backlog-based cursor deactivation is actually tested.
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Mar 18, 2026
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.73%. Comparing base (7f6bc23) to head (7912556).
⚠️ Report is 8 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##             master   #25348       +/-   ##
=============================================
+ Coverage     37.45%   72.73%   +35.27%     
- Complexity    13161    33869    +20708     
=============================================
  Files          1897     1954       +57     
  Lines        150557   154763     +4206     
  Branches      17215    17718      +503     
=============================================
+ Hits          56398   112564    +56166     
+ Misses        86428    33173    -53255     
- Partials       7731     9026     +1295     
Flag Coverage Δ
inttests 25.88% <ø> (-0.17%) ⬇️
systests 22.56% <ø> (+0.06%) ⬆️
unittests 73.70% <ø> (+39.53%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 1417 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 db221ad into apache:master Mar 19, 2026
53 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