lhotari commented on a change in pull request #11226:
URL: https://github.com/apache/pulsar/pull/11226#discussion_r664501098
##########
File path:
managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerTest.java
##########
@@ -2871,4 +2872,22 @@ public void testOpEntryAdd_toString_doesNotThrowNPE(){
", dataLength=" + dataLength +
'}';
}
+
+ @Test
+ public void testLedgerReachMaximumRolloverTime() throws Exception {
+ ManagedLedgerConfig config = new ManagedLedgerConfig();
+ config.setMinimumRolloverTime(1, TimeUnit.MILLISECONDS);
+ config.setMaximumRolloverTime(1, TimeUnit.SECONDS);
+
+ ManagedLedger ml = factory.open("ledger-reach-maximum-rollover-time",
config);
+ long firstLedgerId = ((PositionImpl)
ml.addEntry("test".getBytes())).getLedgerId();
+
+ // the ledger rollover scheduled time is between 1000 and 1050 ms,
+ // wait 1100 ms, the ledger should be rolled over.
+ Awaitility.await()
+ .atMost(1100, TimeUnit.MILLISECONDS)
Review comment:
In general, I think it's better not to test accurate timings. The test
code is cleaner when `.atMost` is omitted. The default value is 10 seconds and
that should be suitable for most cases where the operation is expected to
complete in less than 10 seconds.
--
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]