codelipenghui commented on code in PR #23721:
URL: https://github.com/apache/pulsar/pull/23721#discussion_r1882328011


##########
pulsar-broker/src/test/java/org/apache/pulsar/client/impl/ClientCnxTest.java:
##########
@@ -173,11 +188,47 @@ public void testCnxReceiveSendError() throws Exception {
         // producer also can send message
         producerOne.send("test");
         producerTwo.send("test");
+        producerThree.send("test");
         producerTwo.close();
         producerOne.close();
+        producerThree.close();
         client.close();
     }
 
+    @Test
+    public void testCnxReceiveSendErrorWithConfigMultiPerConnection() throws 
Exception {
+        PulsarClient client = 
PulsarClient.builder().serviceUrl(lookupUrl.toString())
+                .connectionsPerBroker(1000).build();
+
+        // Create a producer with customized name.
+        final String tp = BrokerTestUtil.newUniqueName(NAMESPACE + "/tp");
+        admin.topics().createNonPartitionedTopic(tp);
+        Producer<String> p = 
client.newProducer(Schema.STRING).producerName("p1").topic(tp).create();
+
+        // Inject a persistence error.
+        org.apache.pulsar.broker.service.Producer serverProducer = 
pulsar.getBrokerService().getTopic(tp, false)
+                .join().get().getProducers().values().iterator().next();
+        ServerCnx serverCnx = (ServerCnx) serverProducer.getCnx();
+        
serverCnx.getCommandSender().sendSendError(serverProducer.getProducerId(), 1/* 
sequenceId */,
+                ServerError.PersistenceError, "mocked error");
+        // Wait for the client receives the error.
+        Thread.sleep(1000);

Review Comment:
   Is it possible to use Awaitability to check the client has received the 
error?



##########
pulsar-broker/src/test/java/org/apache/pulsar/client/impl/ClientCnxTest.java:
##########
@@ -173,11 +188,47 @@ public void testCnxReceiveSendError() throws Exception {
         // producer also can send message
         producerOne.send("test");
         producerTwo.send("test");
+        producerThree.send("test");
         producerTwo.close();
         producerOne.close();
+        producerThree.close();
         client.close();
     }
 
+    @Test
+    public void testCnxReceiveSendErrorWithConfigMultiPerConnection() throws 
Exception {

Review Comment:
   testCnxReceiveSendErrorWithMultiConnectionsPerBroker?



-- 
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]

Reply via email to