mirror of
https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka.git
synced 2025-11-02 03:28:01 +00:00
Use BufferedProducer in round robin consumer test
Hopefully this will get rid of the sporadic failures
This commit is contained in:
@@ -77,7 +77,7 @@ TEST_CASE("roundrobin consumer test", "[roundrobin consumer]") {
|
|||||||
PollConsumerRunner runner(consumer, total_messages, KAFKA_NUM_PARTITIONS);
|
PollConsumerRunner runner(consumer, total_messages, KAFKA_NUM_PARTITIONS);
|
||||||
|
|
||||||
// Produce messages so we stop the consumer
|
// Produce messages so we stop the consumer
|
||||||
Producer producer(make_producer_config());
|
BufferedProducer<string> producer(make_producer_config());
|
||||||
string payload = "RoundRobin";
|
string payload = "RoundRobin";
|
||||||
|
|
||||||
// push 3 messages in each partition
|
// push 3 messages in each partition
|
||||||
@@ -86,17 +86,8 @@ TEST_CASE("roundrobin consumer test", "[roundrobin consumer]") {
|
|||||||
.partition(i % KAFKA_NUM_PARTITIONS)
|
.partition(i % KAFKA_NUM_PARTITIONS)
|
||||||
.payload(payload));
|
.payload(payload));
|
||||||
}
|
}
|
||||||
for (int i = 0; i < 3; ++i) {
|
producer.flush();
|
||||||
try {
|
|
||||||
producer.flush();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
catch (const exception& ex) {
|
|
||||||
if (i == 2) {
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runner.try_join();
|
runner.try_join();
|
||||||
|
|
||||||
// Check that we have all messages
|
// Check that we have all messages
|
||||||
|
|||||||
Reference in New Issue
Block a user