You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by pe...@apache.org on 2022/07/25 16:10:34 UTC
[pulsar] branch master updated: [fix][flaky-test] Fix BacklogQuotaManagerTest.testConsumerBacklogEvictionTimeQuotaWithEmptyLedger (#16735)
This is an automated email from the ASF dual-hosted git repository.
penghui 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 70530d4d479 [fix][flaky-test] Fix BacklogQuotaManagerTest.testConsumerBacklogEvictionTimeQuotaWithEmptyLedger (#16735)
70530d4d479 is described below
commit 70530d4d479ea3d4574b9f383ea5edd0fa978d64
Author: Zixuan Liu <no...@gmail.com>
AuthorDate: Tue Jul 26 00:10:25 2022 +0800
[fix][flaky-test] Fix BacklogQuotaManagerTest.testConsumerBacklogEvictionTimeQuotaWithEmptyLedger (#16735)
---
.../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 a71eeea087d..bcdaecaaeb4 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
@@ -541,30 +541,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 = getTopicStats(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 = getTopicStats(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 = getTopicStats(topic);
+ assertEquals(latestStats.getSubscriptions().get(subName).getMsgBacklog(), 0);
+ });
client.close();
}