eolivelli commented on a change in pull request #11294:
URL: https://github.com/apache/pulsar/pull/11294#discussion_r668584890
##########
File path:
pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/TopicPoliciesTest.java
##########
@@ -2144,6 +2143,29 @@ public void testAutoCreationDisabled() throws Exception {
assertNull(admin.topics().getMessageTTL(topic));
}
+ @Test
+ public void testSubscriptionTypesWithPartitionedTopic() throws Exception {
+ final String topic = "persistent://" + myNamespace + "/test-" +
UUID.randomUUID();
+ System.out.println(TopicName.get(topic).getLocalName());
Review comment:
nit: use logger or drop this line
##########
File path:
pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/TopicPoliciesTest.java
##########
@@ -2144,6 +2143,29 @@ public void testAutoCreationDisabled() throws Exception {
assertNull(admin.topics().getMessageTTL(topic));
}
+ @Test
+ public void testSubscriptionTypesWithPartitionedTopic() throws Exception {
+ final String topic = "persistent://" + myNamespace + "/test-" +
UUID.randomUUID();
+ System.out.println(TopicName.get(topic).getLocalName());
+ admin.topics().createPartitionedTopic(topic, 1);
+
pulsarClient.newConsumer().topic(topic).subscriptionName("test").subscribe().close();
+ Awaitility.await()
+ .until(() ->
pulsar.getTopicPoliciesService().cacheIsInitialized(TopicName.get(topic)));
+ Set<SubscriptionType> subscriptionTypeSet = new HashSet<>();
+ subscriptionTypeSet.add(SubscriptionType.Key_Shared);
+ admin.topics().setSubscriptionTypesEnabled(topic, subscriptionTypeSet);
+ Awaitility.await().untilAsserted(() ->
assertNotNull(admin.topics().getSubscriptionTypesEnabled(topic)));
+
+ PersistentTopic persistentTopic = (PersistentTopic)
pulsar.getBrokerService()
+
.getTopicReference(TopicName.get(topic).getPartition(0).toString()).get();
+ Set<String> old = new
HashSet<>(pulsar.getConfiguration().getSubscriptionTypesEnabled());
+ pulsar.getConfiguration().getSubscriptionTypesEnabled().clear();
+ boolean res =
persistentTopic.checkSubscriptionTypesEnable(CommandSubscribe.SubType.Key_Shared);
+ //restore
+ pulsar.getConfiguration().getSubscriptionTypesEnabled().addAll(old);
Review comment:
is it better to do this in a "finally" block ?
--
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]