You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by lh...@apache.org on 2024/10/13 14:57:05 UTC

(pulsar) branch master updated: [fix][test] Fix flaky test ManagedLedgerTest.testDeleteCurrentLedgerWhenItIsClosed (#23437)

This is an automated email from the ASF dual-hosted git repository.

lhotari pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new aa6bc0929bf [fix][test] Fix flaky test ManagedLedgerTest.testDeleteCurrentLedgerWhenItIsClosed (#23437)
aa6bc0929bf is described below

commit aa6bc0929bf28f5e8498ddb2055057b078d46481
Author: Jiawen Wang <74...@users.noreply.github.com>
AuthorDate: Sun Oct 13 22:56:55 2024 +0800

    [fix][test] Fix flaky test ManagedLedgerTest.testDeleteCurrentLedgerWhenItIsClosed (#23437)
---
 .../java/org/apache/bookkeeper/mledger/impl/ManagedLedgerTest.java   | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerTest.java b/managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerTest.java
index 83a6c771513..67c928c8a56 100644
--- a/managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerTest.java
+++ b/managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerTest.java
@@ -4361,9 +4361,10 @@ public class ManagedLedgerTest extends MockedBookKeeperTestCase {
             // Detect the current ledger is full by the timed task. (Imitate: the timed task `checkLedgerRollTask` call
             // `rollCurrentLedgerIfFull` periodically).
             ml.rollCurrentLedgerIfFull();
-            // the ledger closing in the `rollCurrentLedgerIfFull` is async, so the wait is needed.
-            Awaitility.await().untilAsserted(() -> assertEquals(ml.ledgers.size(), 2));
         }
+        // wait the new ledger create
+        Awaitility.await().untilAsserted(() -> assertEquals(ml.ledgers.size(), 2));
+
         // Act: Trigger trimming to delete the previous current ledger.
         ml.internalTrimLedgers(false, Futures.NULL_PROMISE);
         // Verify: A new ledger will be opened after the current ledger is closed and the previous current ledger can be