szaszm commented on code in PR #1412:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1412#discussion_r982294290
##########
extensions/standard-processors/tests/unit/ListenSyslogTests.cpp:
##########
@@ -197,21 +197,10 @@ constexpr std::string_view rfc5424_logger_example_1 =
R"(<13>1 2022-03-17T10:10:
constexpr std::string_view invalid_syslog = "not syslog";
-void sendUDPPacket(const std::string_view content, uint64_t port) {
- asio::io_context io_context;
- asio::ip::udp::socket socket(io_context);
- asio::ip::udp::endpoint
remote_endpoint(asio::ip::address::from_string("127.0.0.1"), port);
- socket.open(asio::ip::udp::v4());
- std::error_code err;
- socket.send_to(asio::buffer(content, content.size()), remote_endpoint, 0,
err);
- REQUIRE(!err);
- socket.close();
-}
-
void check_for_only_basic_attributes(core::FlowFile& flow_file, uint16_t port,
std::string_view protocol) {
CHECK(std::to_string(port) == flow_file.getAttribute("syslog.port"));
CHECK(protocol == flow_file.getAttribute("syslog.protocol"));
- CHECK("127.0.0.1" == flow_file.getAttribute("syslog.sender"));
+ CHECK(("::ffff:127.0.0.1" == flow_file.getAttribute("syslog.sender") ||
"::1" == flow_file.getAttribute("syslog.sender")));
Review Comment:
I would add back the IPv4 non-mapped address, so that the test can run on
boxes with IPv6 disabled as well.
```suggestion
const auto local_addresses = {"127.0.0.1", "::ffff:127.0.0.1", "::1"};
CHECK(std::find(std::begin(local_addresses), std::end(local_addresses),
flow_file.getAttribute("syslog.sender") != std::end(local_addresses));
```
or
```suggestion
const auto local_addresses = {"127.0.0.1", "::ffff:127.0.0.1", "::1"};
CHECK(ranges::contains(local_addresses,
flow_file.getAttribute("syslog.sender")));
```
--
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]