You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/03/17 03:05:40 UTC

[GitHub] [pulsar] murong00 commented on a change in pull request #6537: [Issue 5903] Support `compact` all partitions of a partitioned topic

murong00 commented on a change in pull request #6537: [Issue 5903] Support `compact` all partitions of a partitioned topic
URL: https://github.com/apache/pulsar/pull/6537#discussion_r393420155
 
 

 ##########
 File path: pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/PersistentTopicsTest.java
 ##########
 @@ -439,4 +439,33 @@ public void testRevokePartitionedTopic() {
             Assert.assertEquals(partitionPermissions.get(role), null);
         }
     }
+
+    @Test
+    public void testTriggerCompactionTopic() {
+        final String partitionTopicName = "test-part";
+        final String nonPartitionTopicName = "test-non-part";
+
+        // trigger compaction on non-existing topic
+        AsyncResponse response = mock(AsyncResponse.class);
+        persistentTopics.compact(response, testTenant, testNamespace, "non-existing-topic", true);
+        ArgumentCaptor<RestException> errCaptor = ArgumentCaptor.forClass(RestException.class);
+        verify(response, timeout(5000).times(1)).resume(errCaptor.capture());
+        Assert.assertEquals(errCaptor.getValue().getResponse().getStatus(), Response.Status.NOT_FOUND.getStatusCode());
+
+        // create non partitioned topic and compaction on it
+        response = mock(AsyncResponse.class);
+        persistentTopics.createNonPartitionedTopic(testTenant, testNamespace, nonPartitionTopicName, true);
+        persistentTopics.compact(response, testTenant, testNamespace, nonPartitionTopicName, true);
+        ArgumentCaptor<Response> responseCaptor = ArgumentCaptor.forClass(Response.class);
+        verify(response, timeout(5000).times(1)).resume(responseCaptor.capture());
+        Assert.assertEquals(responseCaptor.getValue().getStatus(), Response.Status.NO_CONTENT.getStatusCode());
+
+        // create partitioned topic and compaction on it
 
 Review comment:
   Added a unit test to cover the compact logic and just keep this top level method call test.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services