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 2022/08/09 14:46:45 UTC

[GitHub] [pulsar] nodece commented on a diff in pull request #17006: [improve][admin] Not allow to terminate system topic.

nodece commented on code in PR #17006:
URL: https://github.com/apache/pulsar/pull/17006#discussion_r941435814


##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminApi2Test.java:
##########
@@ -2533,4 +2533,21 @@ public void testGetNamespaceTopicList() throws Exception {
                 ListNamespaceTopicsOptions.builder().mode(Mode.NON_PERSISTENT).build());
         Assert.assertTrue(notPersistentTopics.contains(nonPersistentTopic));
     }
+
+    @Test
+    private void testTerminateSystemTopic() throws Exception {
+        final String topic = "persistent://prop-xyz/ns1/testTerminateSystemTopic";
+        admin.topics().createNonPartitionedTopic(topic);
+        final String eventTopic = "persistent://prop-xyz/ns1/__change_events";
+        admin.topicPolicies().setMaxConsumers(topic, 2);
+        Awaitility.await().untilAsserted(() -> {
+            Assert.assertEquals(admin.topicPolicies().getMaxConsumers(topic), Integer.valueOf(2));
+        });
+        try {

Review Comment:
   ```suggestion
           PulsarAdminException ex = expectThrows(PulsarAdminException.class, () -> admin.topics().terminateTopic(eventTopic));
           assertTrue(ex instanceof PulsarAdminException.NotAllowedException);
   ```



-- 
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