You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by lh...@apache.org on 2026/02/16 08:38:26 UTC

(pulsar) branch master updated: [fix][test] Fix ResourceQuotaCalculatorImplTest#testNeedToReportLocalUsage (#25247)

This is an automated email from the ASF dual-hosted git repository.

lhotari pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 48774deca86 [fix][test] Fix ResourceQuotaCalculatorImplTest#testNeedToReportLocalUsage (#25247)
48774deca86 is described below

commit 48774deca8691cba964397c53ac19838796b2d77
Author: Yunze Xu <xy...@163.com>
AuthorDate: Mon Feb 16 16:38:19 2026 +0800

    [fix][test] Fix ResourceQuotaCalculatorImplTest#testNeedToReportLocalUsage (#25247)
---
 .../pulsar/broker/resourcegroup/ResourceQuotaCalculatorImplTest.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/resourcegroup/ResourceQuotaCalculatorImplTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/resourcegroup/ResourceQuotaCalculatorImplTest.java
index eeda957bf3e..7859066223e 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/resourcegroup/ResourceQuotaCalculatorImplTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/resourcegroup/ResourceQuotaCalculatorImplTest.java
@@ -113,6 +113,9 @@ public class ResourceQuotaCalculatorImplTest extends MockedPulsarServiceBaseTest
 
     @Test
     public void testNeedToReportLocalUsage() {
+        // This field is 0 when the schedulers of `ResourceGroupService` are not started, then `needToReportLocalUsage`
+        // will always return true. Set it to a non-zero value to test the percentage change logic.
+        ResourceGroupService.maxIntervalForSuppressingReportsMSecs = 60 * 1000L; // 1 minute
         // If the percentage change (increase or decrease) in usage is more than 5% for
         // either bytes or messages, send a report.
         Assert.assertFalse(rqCalc.needToReportLocalUsage(1040, 1000, 104, 100, System.currentTimeMillis()));
@@ -122,4 +125,4 @@ public class ResourceQuotaCalculatorImplTest extends MockedPulsarServiceBaseTest
     }
 
     private ResourceQuotaCalculatorImpl rqCalc;
-}
\ No newline at end of file
+}