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/08/03 04:11:51 UTC

[GitHub] [pulsar] RobertIndie commented on a diff in pull request #16915: [fix][client]Fix MaxQueueSize semaphore release leak in createOpSendMsg

RobertIndie commented on code in PR #16915:
URL: https://github.com/apache/pulsar/pull/16915#discussion_r936217583


##########
pulsar-broker/src/test/java/org/apache/pulsar/client/impl/ProducerSemaphoreTest.java:
##########
@@ -79,6 +79,17 @@ public void testProducerSemaphoreInvalidMessage() throws Exception {
         } catch (PulsarClientException.InvalidMessageException ex) {
             Assert.assertEquals(producer.getSemaphore().get().availablePermits(), pendingQueueSize);
         }
+
+        producer.conf.setBatchingEnabled(false);
+        try {
+            try (MockedStatic<ClientCnx> mockedStatic = Mockito.mockStatic(ClientCnx.class)) {
+                mockedStatic.when(ClientCnx::getMaxMessageSize).thenReturn(2);
+                producer.send("semaphore-test".getBytes(StandardCharsets.UTF_8));
+            }
+            throw new IllegalStateException("can not reach here");

Review Comment:
   You can use `fail()` here.



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