You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/10/18 07:43:51 UTC
[GitHub] [pulsar] nodece commented on a change in pull request #12367: Fix the null point caused by deleting the system topic policy
nodece commented on a change in pull request #12367:
URL: https://github.com/apache/pulsar/pull/12367#discussion_r730649116
##########
File path: pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/TopicPoliciesTest.java
##########
@@ -2643,4 +2643,51 @@ public void testDoNotCreateSystemTopicForHeartbeatNamespace() {
});
}
+ @Test
+ public void testMultipleCreateAndDeleteTopicPolicies() throws Exception {
+ final String topic = testTopic + UUID.randomUUID();
+
+ int n = 0;
+ while (n < 2) {
+ n++;
+ pulsarClient.newProducer().topic(topic).create().close();
+ Awaitility.await().untilAsserted(() -> {
+ Assertions.assertThat(pulsar.getTopicPoliciesService().getTopicPolicies(TopicName.get(topic))).isNull();
+ });
+
+ admin.topics().setMaxConsumersPerSubscription(topic, 1);
+ Awaitility.await().untilAsserted(() -> {
+ Assertions.assertThat(pulsar.getTopicPoliciesService().getTopicPolicies(TopicName.get(topic))).isNotNull();
+ });
+
+ admin.topics().delete(topic);
+ Awaitility.await().untilAsserted(() -> {
+ Assertions.assertThat(pulsar.getTopicPoliciesService().getTopicPolicies(TopicName.get(topic))).isNull();
+ });
+ }
+ }
+
+ @Test
+ public void testLoopCreateAndDeleteTopicPolicies() throws Exception {
+ final String topic = testTopic + UUID.randomUUID();
+
+ int n = 0;
+ while (n < 2) {
+ n++;
+ pulsarClient.newProducer().topic(topic).create().close();
+ Awaitility.await().untilAsserted(() -> {
+ Assertions.assertThat(pulsar.getTopicPoliciesService().getTopicPolicies(TopicName.get(topic))).isNull();
+ });
+
+ admin.topics().setMaxConsumersPerSubscription(topic, 1);
+ Awaitility.await().untilAsserted(() -> {
+ Assertions.assertThat(pulsar.getTopicPoliciesService().getTopicPolicies(TopicName.get(topic))).isNotNull();
+ });
+
+ admin.topics().delete(topic);
+ Awaitility.await().untilAsserted(() -> {
+ Assertions.assertThat(pulsar.getTopicPoliciesService().getTopicPolicies(TopicName.get(topic))).isNull();
+ });
+ }
+ }
Review comment:
fix.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org