szaszm commented on code in PR #1541:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1541#discussion_r1150091534


##########
extensions/expression-language/tests/ExpressionLanguageTests.cpp:
##########
@@ -1342,13 +1342,18 @@ TEST_CASE("Reverse DNS lookup with valid timeout 
parameter", "[ExpressionLanguag
 
   SECTION("Should timeout") {
     auto reverse_lookup_expr_0ms = 
expression::compile("${reverseDnsLookup(${ip_addr}, 0)}");
-    
REQUIRE_NOTHROW(reverse_lookup_expr_0ms(expression::Parameters{flow_file_a}).asString()
 == "8.8.8.8");
+    std::string reverse_lookup_result = "dns.google";
+    // Occasionally it doesn't time out even with 0ms timeout because it 
finishes before the timeout-thread starts
+    for (auto number_of_tries = 1; number_of_tries <= 5 && 
reverse_lookup_result == "dns.google"; ++number_of_tries) {
+      reverse_lookup_result = 
reverse_lookup_expr_0ms(expression::Parameters{flow_file_a}).asString();
+    }

Review Comment:
   If the timeout doesn't happen deterministically, then I'd rather not test it 
at all in a unit test. I also wouldn't want to short-circuit 0ms to always time 
out if it wouldn't normally happen, since that would degrade the functionality.



-- 
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]

Reply via email to