eolivelli commented on code in PR #19086:
URL: https://github.com/apache/pulsar/pull/19086#discussion_r1058149005
##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/persistent/PersistentTopicTest.java:
##########
@@ -402,4 +405,22 @@ public void testUpdateCursorLastActive() throws Exception {
assertTrue(persistentSubscription.getCursor().getLastActive() >
beforeRemoveConsumerTimestamp);
assertTrue(persistentSubscription2.getCursor().getLastActive() >
beforeRemoveConsumerTimestamp);
}
+
+
+ @Test
+ public void testCreateNonExistentPartitions() throws PulsarAdminException {
+ final String topicName =
"non-persistent://prop/ns-abc/testCreateNonExistentPartitions";
+ admin.topics().createPartitionedTopic(topicName, 4);
+ TopicName partition = TopicName.get(topicName).getPartition(4);
+ try {
+ @Cleanup
+ Producer<byte[]> producer = pulsarClient.newProducer()
+ .topic(partition.toString())
+ .create();
+ fail("unexpected behaviour");
+ } catch (PulsarClientException ex) {
Review Comment:
nit: you can catch directly TopicDoesNotExistException and let other
exception escape the try block
otherwise if the exception is not the expected the logs won't tell you
anything useful
--
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]