cbornet commented on a change in pull request #12699:
URL: https://github.com/apache/pulsar/pull/12699#discussion_r746470768
##########
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:
Note that currently it's possible to create a topic partition from the
subscription creation without the full partitioned topic being created. Is it
OK to be able to do that ?
--
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]