fgerlits commented on a change in pull request #1137:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1137#discussion_r686119287



##########
File path: docker/test/integration/features/attributes_to_json.feature
##########
@@ -0,0 +1,15 @@
+Feature: Writing attribute data using AttributesToJSON processor
+  Background:
+    Given the content of "/tmp/output" is monitored
+
+  Scenario: Write selected attribute data to file
+    Given a GetFile processor with the "Input Directory" property set to 
"/tmp/input"
+    And a file with filename "test_file.log" and content "test_data%" is 
present in "/tmp/input"

Review comment:
       just picking nits, but what is the purpose of the `%` sign?

##########
File path: libminifi/test/TestBase.h
##########
@@ -164,6 +165,31 @@ class LogTestController {
     return found;
   }
 
+  std::optional<std::smatch> matchesRegex(const std::string &regex_str,
+                std::chrono::seconds timeout = std::chrono::seconds(3),
+                std::chrono::milliseconds sleep_interval = 
std::chrono::milliseconds(200)) {
+    if (regex_str.length() == 0) {
+      return std::nullopt;
+    }
+    auto start = std::chrono::system_clock::now();
+    bool found = false;
+    bool timed_out = false;
+    std::regex matcher_regex(regex_str);
+    std::smatch match;
+    do {
+      std::string str = log_output.str();
+      found = std::regex_search(str, match, matcher_regex);
+      auto now = std::chrono::system_clock::now();
+      timed_out = std::chrono::duration_cast<std::chrono::milliseconds>(now - 
start) > std::chrono::duration_cast<std::chrono::milliseconds>(timeout);

Review comment:
       I don't think these `duration_cast`s are needed; 
`std::chrono::duration`s constructed with different units can be compared.
   ```suggestion
         timed_out = (now - start > timeout);
   ```




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