merlimat opened a new pull request, #25476:
URL: https://github.com/apache/pulsar/pull/25476

   ## Motivation
   
   `ManagedLedgerTest.testCursorPointsToDeletedLedgerAfterTrim` is flaky 
because it injects a 30s BK write delay and then asserts the persistent 
position hasn't advanced. However, the outcome is timing-dependent: sometimes 
the delayed persistence completes before the trim checks cursor positions, 
sometimes not.
   
   The test's assertions were also incorrect — 
`maybeUpdateCursorBeforeTrimmingConsumedLedger()` is designed to advance the 
cursor past fully consumed ledgers, and it's perfectly fine for the persistent 
position to advance. The old assertions expected the persistent position to 
remain at the old value.
   
   ### Stack trace
   ```
   ManagedLedgerTest > testCursorPointsToDeletedLedgerAfterTrim FAILED
       java.lang.AssertionError: Persistent position should not have advanced 
(delayed)
           expected [3:0] but found [4:-1]
           at 
ManagedLedgerTest.testCursorPointsToDeletedLedgerAfterTrim(ManagedLedgerTest.java:4823)
   ```
   
   ## Modifications
   
   Simplify the test by removing the 30s BK write delay and the complex 
out-of-order deletion pattern. The test now straightforwardly verifies that 
`maybeUpdateCursorBeforeTrimmingConsumedLedger` advances the cursor past a 
fully consumed ledger, and trimming correctly deletes it.
   
   ### Documentation
   - [x] `doc-not-needed`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to