codelipenghui commented on a change in pull request #12699:
URL: https://github.com/apache/pulsar/pull/12699#discussion_r746168576
##########
File path:
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BrokerServiceAutoTopicCreationTest.java
##########
@@ -350,6 +350,37 @@ public void testNotAllowSubscriptionTopicCreation() throws
Exception{
}
+ @Test
+ public void testAutoCreationNamespaceOverridesSubscriptionTopicCreation()
throws Exception {
+ pulsar.getConfiguration().setAllowAutoTopicCreation(false);
+ String topicString = "persistent://prop/ns-abc/non-partitioned-topic"
+ System.currentTimeMillis();
+ String subscriptionName = "non-partitioned-topic-sub";
+ final TopicName topicName = TopicName.get(topicString);
+
pulsar.getAdminClient().namespaces().setAutoTopicCreation(topicName.getNamespace(),
+ AutoTopicCreationOverride.builder()
+ .allowAutoTopicCreation(true)
+ .topicType(TopicType.NON_PARTITIONED.toString())
+ .build());
+
+ admin.topics().createSubscription(topicString, subscriptionName,
MessageId.earliest);
+ }
+
+ @Test
+ public void
testAutoCreationNamespaceOverridesSubscriptionPartitionedTopicCreation() throws
Exception {
+ pulsar.getConfiguration().setAllowAutoTopicCreation(false);
+ String topicString = "persistent://prop/ns-abc/partitioned-topic" +
System.currentTimeMillis();
+ String subscriptionName = "partitioned-topic-sub";
+ final TopicName topicName = TopicName.get(topicString);
+
pulsar.getAdminClient().namespaces().setAutoTopicCreation(topicName.getNamespace(),
+ AutoTopicCreationOverride.builder()
+ .allowAutoTopicCreation(true)
+ .topicType(TopicType.PARTITIONED.toString())
+ .defaultNumPartitions(3)
+ .build());
+
+ admin.topics().createSubscription(topicString + "-partition-0",
subscriptionName, MessageId.earliest);
Review comment:
Sorry, I don't understand why change the namespace level policy for
topic auto-creation to create partitioned topic with 3 partitions, but here
check if able to subscribe to one partition, looks like not able to ensure the
partitioned topic has been created?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]