michaeljmarshall commented on a change in pull request #14000:
URL: https://github.com/apache/pulsar/pull/14000#discussion_r794223666



##########
File path: 
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BacklogQuotaManagerTest.java
##########
@@ -475,10 +477,12 @@ public void testConsumerBacklogEvictionTimeQuota() throws 
Exception {
         rolloverStats();
 
         stats = admin.topics().getStats(topic1);
+        PersistentTopic topic1Reference = (PersistentTopic) 
pulsar.getBrokerService().getTopicReference(topic1).get();
+        ManagedLedgerImpl ml = (ManagedLedgerImpl) 
topic1Reference.getManagedLedger();
         // Messages on first 2 ledgers should be expired, backlog is number of
-        // message in current ledger which should be 4.
-        assertEquals(stats.getSubscriptions().get(subName1).getMsgBacklog(), 
4);
-        assertEquals(stats.getSubscriptions().get(subName2).getMsgBacklog(), 
4);
+        // message in current ledger.
+        assertEquals(stats.getSubscriptions().get(subName1).getMsgBacklog(), 
ml.getNumberOfEntries());

Review comment:
       This is an interesting problem, considering the reporting issue failed 
with an actual value of 5. Since we produce 14 messages, that means one of the 
other two ledgers for this test only had 4 entries.
   
   What if we also assert that `ml.getNumberOfEntries() >= 4` and also assert 
that `ml.getLedgersInfoAsList().size() == 1`? That way we don't lose too much 
precision in the test?




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