Skip to content

Commit

Permalink
[fix][test] Fix flaky test SimpleProducerConsumerStatTest#testPartiti…
Browse files Browse the repository at this point in the history
…onTopicStats (apache#21642)
  • Loading branch information
Technoboy- committed Nov 29, 2023
1 parent 81a9a52 commit 93ed61b
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import org.awaitility.Awaitility;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
Expand Down Expand Up @@ -495,9 +496,10 @@ public void testPartitionTopicStats() throws Exception {
msg = consumer.receive(5, TimeUnit.SECONDS);
String receivedMessage = new String(msg.getData());
log.info("Received message: [{}]", receivedMessage);
String expectedMessage = "my-message-" + i;
testMessageOrderAndDuplicates(messageSet, receivedMessage, expectedMessage);
Assert.assertTrue(messageSet.add(receivedMessage), "Received duplicate message " + receivedMessage);
}
Assert.assertEquals(messageSet.size(), numMessages);

// Acknowledge the consumption of all messages at once
consumer.acknowledgeCumulative(msg);

Expand Down

0 comments on commit 93ed61b

Please sign in to comment.