mattisonchao commented on a change in pull request #13573:
URL: https://github.com/apache/pulsar/pull/13573#discussion_r780132444
##########
File path:
pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/PersistentTopicsTest.java
##########
@@ -1148,4 +1149,18 @@ public void testAdminTerminatePartitionedTopic() throws
Exception{
Assert.assertEquals(e.getMessage(), "Termination of a
non-partitioned topic is not allowed using partitioned-terminate, please use
terminate commands.");
}
}
+
+ @Test
+ public void testTopicReferenceCommonExceptionWillReturnRestException() {
+ String topicName = "topicName";
+ String exceptionDetail = "exceptionDetail";
+ doThrow(new
RuntimeException(exceptionDetail)).when(pulsar).getBrokerService();
Review comment:
done.
##########
File path:
pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/PersistentTopicsTest.java
##########
@@ -1148,4 +1149,18 @@ public void testAdminTerminatePartitionedTopic() throws
Exception{
Assert.assertEquals(e.getMessage(), "Termination of a
non-partitioned topic is not allowed using partitioned-terminate, please use
terminate commands.");
}
}
+
+ @Test
+ public void testTopicReferenceCommonExceptionWillReturnRestException() {
+ String topicName = "topicName";
+ String exceptionDetail = "exceptionDetail";
+ doThrow(new
RuntimeException(exceptionDetail)).when(pulsar).getBrokerService();
+ try{
Review comment:
done.
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
##########
@@ -3737,11 +3738,13 @@ private Topic getTopicReference(TopicName topicName) {
.orElseThrow(() -> topicNotFoundReason(topicName));
} catch (RestException e) {
throw e;
+ } catch (TimeoutException e){
Review comment:
Should I move it to ``Exception`` catch and then ``instanceof`` ? I mean
if I don't return timeout. I can't tell if we're getting NPE.
##########
File path:
pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/PersistentTopicsTest.java
##########
@@ -1148,4 +1149,19 @@ public void testAdminTerminatePartitionedTopic() throws
Exception{
Assert.assertEquals(e.getMessage(), "Termination of a
non-partitioned topic is not allowed using partitioned-terminate, please use
terminate commands.");
}
}
+
+ @Test
+ public void testResetCursorReturnTimeoutWhenZKTimeout() {
+ String topic = "persistent://"+testTenant + "/"+ testNamespace + "/" +
"topic-2";
+ BrokerService brokerService = spy(pulsar.getBrokerService());
+ doReturn(brokerService).when(pulsar).getBrokerService();
+ CompletableFuture<Optional<Topic>> completableFuture = new
CompletableFuture<>();
+
doReturn(completableFuture).when(brokerService).getTopicIfExists(topic);
+ try {
+ admin.topics().resetCursor(topic, "my-sub",
System.currentTimeMillis());
Review comment:
fixed
--
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]