Skip to content

[fix][test] Fix flaky ConsumedLedgersTrimTest.testAdminTrimLedgers#25342

Merged
lhotari merged 1 commit intoapache:masterfrom
merlimat:fix/flaky-ConsumedLedgersTrimTest
Mar 19, 2026
Merged

[fix][test] Fix flaky ConsumedLedgersTrimTest.testAdminTrimLedgers#25342
lhotari merged 1 commit intoapache:masterfrom
merlimat:fix/flaky-ConsumedLedgersTrimTest

Conversation

@merlimat
Copy link
Copy Markdown
Contributor

@merlimat merlimat commented Mar 17, 2026

Flaky test failure

org.awaitility.core.ConditionTimeoutException: Assertion condition expected [1] but found [2] within 10 seconds.
	at org.apache.pulsar.broker.service.ConsumedLedgersTrimTest.testAdminTrimLedgers

Summary

  • Fix flaky ConsumedLedgersTrimTest.testAdminTrimLedgers which asserts exactly 1 ledger remains after trimming consumed ledgers.
  • With maxEntriesPerLedger=2, if partition-0 receives an even number of messages, the last ledger becomes full and a new empty active ledger is created. After trimming, 2 ledgers remain: the one containing the last confirmed entry (cannot be trimmed) and the new empty active ledger.
  • Change assertion from assertEquals(size, 1) to assertTrue(size <= 2) since the remaining count depends on whether the last write caused a ledger rollover.

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 trimTopic operation is async and the default 10s Awaitility
timeout may not be sufficient for the ledger deletion metadata
operations to complete. Increase timeout to 30s.
@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.77%. Comparing base (7f6bc23) to head (b0ec11a).
⚠️ Report is 7 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##             master   #25342       +/-   ##
=============================================
+ Coverage     37.45%   72.77%   +35.31%     
- Complexity    13161    33762    +20601     
=============================================
  Files          1897     1954       +57     
  Lines        150557   154745     +4188     
  Branches      17215    17709      +494     
=============================================
+ Hits          56398   112612    +56214     
+ Misses        86428    33111    -53317     
- Partials       7731     9022     +1291     
Flag Coverage Δ
inttests 25.78% <ø> (-0.27%) ⬇️
systests 22.53% <ø> (+0.03%) ⬆️
unittests 73.74% <ø> (+39.57%) ⬆️

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