315157973 commented on a change in pull request #9382:
URL: https://github.com/apache/pulsar/pull/9382#discussion_r567520378
##########
File path:
pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/TopicPoliciesTest.java
##########
@@ -201,6 +201,29 @@ public void testCheckBacklogQuota() throws Exception {
admin.topics().deletePartitionedTopic(testTopic, true);
}
+ @Test
+ public void testCheckBacklogQuotaFailed() throws Exception {
+ RetentionPolicies retentionPolicies = new RetentionPolicies(10, 10);
+ String namespace = TopicName.get(testTopic).getNamespace();
+ admin.namespaces().setRetention(namespace, retentionPolicies);
+
+ Awaitility.await().atMost(3, TimeUnit.SECONDS)
+ .untilAsserted(() ->
Assert.assertEquals(admin.namespaces().getRetention(namespace),
retentionPolicies));
+
+ BacklogQuota backlogQuota =
+ new BacklogQuota(10 * 1024 * 1024,
BacklogQuota.RetentionPolicy.consumer_backlog_eviction);
+ try {
+ admin.topics().setBacklogQuota(testTopic, backlogQuota);
+ Assert.fail();
+ } catch (PulsarAdminException e) {
+ Assert.assertEquals(e.getStatusCode(), 412);
+ }
+ //Ensure that the cache has not been updated after a long time
+ Awaitility.await().atLeast(1, TimeUnit.SECONDS);
+ assertNull(admin.topics().getBacklogQuotaMap(testTopic)
+ .get(BacklogQuota.BacklogQuotaType.destination_storage));
Review comment:
The default value of the cache is null, so this will always pass.
Our original intention is that it takes time to update the cache, and after
waiting for a period of time, it is determined whether the cache has not been
updated.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]