This is an automated email from the ASF dual-hosted git repository.
bogong pushed a commit to branch branch-2.9
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/branch-2.9 by this push:
new bf54c696052 cherry-pick -x "70530d4"
bf54c696052 is described below
commit bf54c6960525ccdf30b21c322db954b1a3527e14
Author: Zixuan Liu <[email protected]>
AuthorDate: Tue Jul 26 00:10:25 2022 +0800
cherry-pick -x "70530d4"
---
.../broker/service/BacklogQuotaManagerTest.java | 35 ++++++++++------------
1 file changed, 16 insertions(+), 19 deletions(-)
diff --git
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BacklogQuotaManagerTest.java
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BacklogQuotaManagerTest.java
index f313a0f5d87..c824683f09f 100644
---
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BacklogQuotaManagerTest.java
+++
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BacklogQuotaManagerTest.java
@@ -521,30 +521,27 @@ public class BacklogQuotaManagerTest {
consumer.receive();
admin.topics().unload(topic);
- Awaitility.await().until(consumer::isConnected);
- PersistentTopicInternalStats internalStats =
admin.topics().getInternalStats(topic);
- assertEquals(internalStats.ledgers.size(), 2);
- assertEquals(internalStats.ledgers.get(1).entries, 0);
+
+ Awaitility.await().untilAsserted(() -> {
+ PersistentTopicInternalStats internalStats =
admin.topics().getInternalStats(topic);
+ assertEquals(internalStats.ledgers.size(), 2);
+ assertEquals(internalStats.ledgers.get(1).entries, 0);
+ });
TopicStats stats = admin.topics().getStats(topic);
assertEquals(stats.getSubscriptions().get(subName).getMsgBacklog(), 1);
- TimeUnit.SECONDS.sleep(TIME_TO_CHECK_BACKLOG_QUOTA);
-
- Awaitility.await()
- .pollInterval(Duration.ofSeconds(1))
- .atMost(Duration.ofSeconds(TIME_TO_CHECK_BACKLOG_QUOTA))
- .untilAsserted(() -> {
- rolloverStats();
+ rolloverStats();
- // Cause the last ledger is empty, it is not possible to
skip first ledger,
- // so the number of ledgers will keep unchanged, and
backlog is clear
- PersistentTopicInternalStats latestInternalStats =
admin.topics().getInternalStats(topic);
- assertEquals(latestInternalStats.ledgers.size(), 2);
- assertEquals(latestInternalStats.ledgers.get(1).entries,
0);
- TopicStats latestStats = admin.topics().getStats(topic);
-
assertEquals(latestStats.getSubscriptions().get(subName).getMsgBacklog(), 0);
- });
+ Awaitility.await().untilAsserted(() -> {
+ // Cause the last ledger is empty, it is not possible to skip
first ledger,
+ // so the number of ledgers will keep unchanged, and backlog is
clear
+ PersistentTopicInternalStats latestInternalStats =
admin.topics().getInternalStats(topic);
+ assertEquals(latestInternalStats.ledgers.size(), 2);
+ assertEquals(latestInternalStats.ledgers.get(1).entries, 0);
+ TopicStats latestStats = admin.topics().getStats(topic);
+
assertEquals(latestStats.getSubscriptions().get(subName).getMsgBacklog(), 0);
+ });
client.close();
}