Skip to content

Commit

Permalink
[fix][test] Fix flaky test ManagedLedgerTest.testDeleteCurrentLedgerW…
Browse files Browse the repository at this point in the history
…henItIsClosed (apache#23437)

(cherry picked from commit aa6bc09)
(cherry picked from commit 40f83aa)
  • Loading branch information
summeriiii authored and nikhil-ctds committed Oct 15, 2024
1 parent c726c31 commit 3df3325
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4358,9 +4358,10 @@ public void testDeleteCurrentLedgerWhenItIsClosed(boolean closeLedgerByAddEntry)
// 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
Expand Down

0 comments on commit 3df3325

Please sign in to comment.