martinzink commented on code in PR #1457:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1457#discussion_r1085102784
##########
extensions/standard-processors/tests/unit/ListenTcpTests.cpp:
##########
@@ -194,31 +194,115 @@ TEST_CASE("Test ListenTCP with SSL connection",
"[ListenTCP][NetworkListenerProc
expected_successful_messages = {"test_message_1", "another_message"};
for (const auto& message : expected_successful_messages) {
- REQUIRE(utils::sendMessagesViaSSL({message}, endpoint, executable_dir /
"resources" / "ca_A.crt", ssl_data));
+ CHECK_THAT(utils::sendMessagesViaSSL({message}, endpoint, executable_dir
/ "resources" / "ca_A.crt", ssl_data), MatchesSuccess());
}
}
SECTION("Required certificate not provided") {
+ ssl_context_service->enable();
+ REQUIRE(controller.plan->setProperty(listen_tcp,
ListenTCP::ClientAuth.getName(), "REQUIRED"));
+ port = utils::scheduleProcessorOnRandomPort(controller.plan, listen_tcp);
SECTION("sending through IPv4", "[IPv4]") {
- endpoint = asio::ip::tcp::endpoint(asio::ip::address_v4::loopback(),
PORT);
+ endpoint = asio::ip::tcp::endpoint(asio::ip::address_v4::loopback(),
port);
}
SECTION("sending through IPv6", "[IPv6]") {
if (utils::isIPv6Disabled())
return;
- endpoint = asio::ip::tcp::endpoint(asio::ip::address_v6::loopback(),
PORT);
+ endpoint = asio::ip::tcp::endpoint(asio::ip::address_v6::loopback(),
port);
}
- REQUIRE(controller.plan->setProperty(listen_tcp,
ListenTCP::ClientAuth.getName(), "REQUIRED"));
- ssl_context_service->enable();
- controller.plan->scheduleProcessor(listen_tcp);
- REQUIRE_FALSE(utils::sendMessagesViaSSL({"test_message_1"}, endpoint,
executable_dir / "resources" / "ca_A.crt"));
+ auto send_error = utils::sendMessagesViaSSL({"test_message_1"}, endpoint,
executable_dir / "resources" / "ca_A.crt");
+ CHECK(send_error);
Review Comment:
I coudnt find any ways to readably include the expected error. (asio
constructs these in a fairly complicated way, there is no enum or anything like
that, that I could use)
So I've left this with the MatchesError
https://github.com/apache/nifi-minifi-cpp/pull/1457/files#diff-cba941a459893c41b8743d9b8423acf61afa575e3252a61773f8cb7949dc6626R214
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]