lhotari commented on code in PR #22344:
URL: https://github.com/apache/pulsar/pull/22344#discussion_r1540634018


##########
managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerTest.java:
##########
@@ -2642,10 +2642,10 @@ public void testGetNumberOfEntriesInStorage() throws 
Exception {
             managedLedger.addEntry(("entry-" + i).getBytes(Encoding));
         }
 
-        //trigger ledger rollover and wait for the new ledger created
-        Field stateUpdater = ManagedLedgerImpl.class.getDeclaredField("state");
-        stateUpdater.setAccessible(true);
-        stateUpdater.set(managedLedger, ManagedLedgerImpl.State.LedgerOpened);
+        // trigger ledger rollover and wait for the new ledger created
+        Awaitility.await().untilAsserted(() -> {
+           assertEquals("LedgerOpened", 
WhiteboxImpl.getInternalState(managedLedger, "state").toString());

Review Comment:
   I agree. I guess this is a topic of another possible PR. I'll resolve this 
discussion so that we can merge the fix.



-- 
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