Line data Source code
1 : /**
2 : * @file OpMonPublisher_test.cxx Test application that tests invalid constructions of OpMonPublisher
3 : *
4 : * This is part of the DUNE DAQ Application Framework, copyright 2020.
5 : * Licensing/copyright details are in the COPYING file that you should have
6 : * received with this code.
7 : */
8 :
9 : #define BOOST_TEST_MODULE opmon_publisher_test // NOLINT
10 :
11 : #include "boost/test/unit_test.hpp"
12 :
13 : #include <kafkaopmon/OpMonPublisher.hpp>
14 :
15 : using namespace dunedaq::kafkaopmon;
16 : using namespace dunedaq::opmon;
17 :
18 : BOOST_AUTO_TEST_SUITE(OpMonPublisher_Test)
19 :
20 2 : BOOST_AUTO_TEST_CASE(Invalid_Creation) {
21 :
22 1 : nlohmann::json conf;
23 :
24 2 : BOOST_CHECK_THROW( OpMonPublisher p(conf),
25 : MissingParameter );
26 :
27 1 : conf["bootstrap"] = "invalid.address.none:1234";
28 :
29 2 : BOOST_CHECK_NO_THROW( OpMonPublisher p(conf) );
30 :
31 : // this is a bit annoyting, but it is what it is
32 : // Kakfa creates a producer but the check of the correctness is done asynchronously
33 : // As a result, even with an invalid address, the best we get in a very silent error message
34 :
35 1 : }
36 :
37 : BOOST_AUTO_TEST_SUITE_END()
38 :
39 :
40 :
41 :
|