Skip to content

Commit 0cbd624

Browse files
BewareMyPowermanas-ctds
authored andcommitted
[fix][test] Fix ResourceQuotaCalculatorImplTest#testNeedToReportLocalUsage (apache#25247)
(cherry picked from commit 48774de)
1 parent c80b6c9 commit 0cbd624

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pulsar-broker/src/test/java/org/apache/pulsar/broker/resourcegroup/ResourceQuotaCalculatorImplTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ public void testRQCalcGlobUsedZeroTest() throws PulsarAdminException {
113113

114114
@Test
115115
public void testNeedToReportLocalUsage() {
116+
// This field is 0 when the schedulers of `ResourceGroupService` are not started, then `needToReportLocalUsage`
117+
// will always return true. Set it to a non-zero value to test the percentage change logic.
118+
ResourceGroupService.maxIntervalForSuppressingReportsMSecs = 60 * 1000L; // 1 minute
116119
// If the percentage change (increase or decrease) in usage is more than 5% for
117120
// either bytes or messages, send a report.
118121
Assert.assertFalse(rqCalc.needToReportLocalUsage(1040, 1000, 104, 100, System.currentTimeMillis()));
@@ -122,4 +125,4 @@ public void testNeedToReportLocalUsage() {
122125
}
123126

124127
private ResourceQuotaCalculatorImpl rqCalc;
125-
}
128+
}

0 commit comments

Comments
 (0)