Skip to content

Commit 48774de

Browse files
[fix][test] Fix ResourceQuotaCalculatorImplTest#testNeedToReportLocalUsage (#25247)
1 parent 9db31cc commit 48774de

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

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)