Skip to content

Commit 6c17641

Browse files
Dream95srinath-ctds
authored andcommitted
[fix][test] Fix invalid test NonPersistentTopicTest.testProducerRateLimit (apache#24957)
Signed-off-by: Dream95 <[email protected]> (cherry picked from commit 0896c0a) (cherry picked from commit 66b7f7c)
1 parent 75368ac commit 6c17641

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pulsar-broker/src/test/java/org/apache/pulsar/client/api/NonPersistentTopicTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,13 +380,14 @@ public void testProducerRateLimit() throws Exception {
380380
var producerName = BrokerTestUtil.newUniqueName("testProducerRateLimit");
381381
@Cleanup
382382
Producer<byte[]> producer = pulsarClient.newProducer().topic(topic).producerName(producerName).create();
383-
byte[] msgData = "testData".getBytes();
384383
final int totalProduceMessages = 500;
385384
CountDownLatch latch = new CountDownLatch(totalProduceMessages);
386385
for (int i = 0; i < totalProduceMessages; i++) {
386+
final int messageIndex = i;
387387
executor.submit(() -> {
388388
try {
389-
producer.send(msgData);
389+
String message = "my-message-" + messageIndex;
390+
producer.send(message.getBytes());
390391
} catch (Exception e) {
391392
log.error("Failed to send message", e);
392393
failed.set(true);

0 commit comments

Comments
 (0)