Skip to content

Commit

Permalink
[fix][test] Fix flaky test ManagedLedgerTest.testDeleteCurrentLedgerW…
Browse files Browse the repository at this point in the history
…henItIsClosed (#23437)
  • Loading branch information
summeriiii authored Oct 13, 2024
1 parent 390d7d9 commit aa6bc09
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4361,9 +4361,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 aa6bc09

Please # to comment.