You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by lh...@apache.org on 2025/11/11 09:44:16 UTC

(pulsar) 02/03: [fix][test] Fix invalid test NonPersistentTopicTest.testProducerRateLimit (#24957)

This is an automated email from the ASF dual-hosted git repository.

lhotari pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/pulsar.git

commit 65320e799997b36be06268e680c0f1a85c18558f
Author: Dream95 <86...@qq.com>
AuthorDate: Mon Nov 10 20:10:11 2025 +0800

    [fix][test] Fix invalid test NonPersistentTopicTest.testProducerRateLimit (#24957)
    
    Signed-off-by: Dream95 <zh...@163.com>
    (cherry picked from commit 0896c0a5fe23c57179faf8752b416bee5e43b6a2)
---
 .../java/org/apache/pulsar/client/api/NonPersistentTopicTest.java    | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/NonPersistentTopicTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/NonPersistentTopicTest.java
index e0df107f73f..11b20c1f202 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/NonPersistentTopicTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/NonPersistentTopicTest.java
@@ -362,13 +362,14 @@ public class NonPersistentTopicTest extends ProducerConsumerBase {
             Consumer<byte[]> consumer = pulsarClient.newConsumer().topic(topic).subscriptionName("subscriber-1")
                     .subscribe();
             Producer<byte[]> producer = pulsarClient.newProducer().topic(topic).create();
-            byte[] msgData = "testData".getBytes();
             final int totalProduceMessages = 500;
             CountDownLatch latch = new CountDownLatch(totalProduceMessages);
             for (int i = 0; i < totalProduceMessages; i++) {
+                final int messageIndex = i;
                 executor.submit(() -> {
                     try {
-                        producer.send(msgData);
+                        String message = "my-message-" + messageIndex;
+                        producer.send(message.getBytes());
                     } catch (Exception e) {
                         log.error("Failed to send message", e);
                         failed.set(true);