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 2022/04/22 14:04:29 UTC

[GitHub] [pulsar] lhotari commented on a diff in pull request #14870: [fix][java-client] Fix message publishing stuck when enabling batch

lhotari commented on code in PR #14870:
URL: https://github.com/apache/pulsar/pull/14870#discussion_r856265858


##########
pulsar-broker/src/test/java/org/apache/pulsar/client/impl/ProducerCloseTest.java:
##########
@@ -99,6 +103,25 @@ public void testProducerCloseFailsPendingBatchWhenPreviousStateNotReadyCallback(
         }
     }
 
+    @Test(timeOut = 10_000)
+    public void brokerCloseTest() throws Exception {
+        initClient();
+
+        String topic = "broker-close-test-" + RandomStringUtils.randomAlphabetic(5);
+        @Cleanup
+        ProducerImpl<byte[]> producer = (ProducerImpl<byte[]>) pulsarClient.newProducer()
+                .topic(topic)
+                .create();
+        producer.newMessage().value("test".getBytes()).send();
+
+        Optional<Topic> topicOptional = pulsar.getBrokerService()
+                .getTopicReference(TopicName.get(topic).getPartitionedTopicName());
+        Assert.assertTrue(topicOptional.isPresent());
+        topicOptional.get().close(true).get();
+        Assert.assertEquals(producer.getState(), HandlerState.State.Connecting);

Review Comment:
   Indeed, this introduced a new flaky test, #15277 .



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org