Skip to content

Commit

Permalink
add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-du-car committed Jul 6, 2023
1 parent 89f0d54 commit 1409c16
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/tmx/TmxUtils/test/test_kafka_producer_worker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,18 @@ TEST(test_kafka_producer_worker, create_producer)
worker->send(msg);
worker->stop();
}

TEST(test_kafka_producer_worker, create_producer_no_topic)
{
std::string broker_str = "localhost:9092";
std::string topic = "test";
auto client = std::make_shared<tmx::utils::kafka_client>();
std::shared_ptr<tmx::utils::kafka_producer_worker> worker;
worker = client->create_producer(broker_str);
worker->init();
worker->printCurrConf();
std::string msg = "test message";
// // Run this unit test without launching kafka broker will throw connection refused error
worker->send(msg, topic);
worker->stop();
}

0 comments on commit 1409c16

Please sign in to comment.