You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ad...@apache.org on 2022/04/01 10:58:29 UTC

[nifi-minifi-cpp] 03/05: MINIFICPP-1789 - Log checking is wrong in integration tests

This is an automated email from the ASF dual-hosted git repository.

adebreceni pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git

commit 163c7c27efab153f26be5b54cbeb67ee6daadca4
Author: Adam Markovics <nu...@gmail.com>
AuthorDate: Fri Apr 1 12:54:22 2022 +0200

    MINIFICPP-1789 - Log checking is wrong in integration tests
    
    Signed-off-by: Adam Debreceni <ad...@apache.org>
    
    This closes #1290
---
 docker/test/integration/MiNiFi_integration_test_driver.py | 4 ++--
 docker/test/integration/features/mqtt.feature             | 6 +++---
 docker/test/integration/steps/steps.py                    | 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/docker/test/integration/MiNiFi_integration_test_driver.py b/docker/test/integration/MiNiFi_integration_test_driver.py
index 138e4fe..91a39e8 100644
--- a/docker/test/integration/MiNiFi_integration_test_driver.py
+++ b/docker/test/integration/MiNiFi_integration_test_driver.py
@@ -247,8 +247,8 @@ class MiNiFi_integration_test():
     def check_query_results(self, postgresql_container_name, query, number_of_rows, timeout_seconds):
         assert self.cluster.check_query_results(postgresql_container_name, query, number_of_rows, timeout_seconds)
 
-    def wait_for_container_logs(self, container_name, log_pattern, timeout_seconds, count=1):
-        self.cluster.wait_for_app_logs_regex(container_name, log_pattern, timeout_seconds, count)
+    def check_container_log_matches_regex(self, container_name, log_pattern, timeout_seconds, count=1):
+        assert self.cluster.wait_for_app_logs_regex(container_name, log_pattern, timeout_seconds, count)
 
     def add_test_blob(self, blob_name, content, with_snapshot):
         self.cluster.add_test_blob(blob_name, content, with_snapshot)
diff --git a/docker/test/integration/features/mqtt.feature b/docker/test/integration/features/mqtt.feature
index 784e7ac..bcdcaec 100644
--- a/docker/test/integration/features/mqtt.feature
+++ b/docker/test/integration/features/mqtt.feature
@@ -33,7 +33,7 @@ Feature: Sending data to MQTT streaming platform using PublishMQTT
 
     When both instances start up
     Then a flowfile with the content "test" is placed in the monitored directory in less than 60 seconds
-    And the MQTT broker has a log line matching "Received PUBLISH from .*testtopic.*\\(4 bytes\\)"
+    And the MQTT broker has a log line matching "Received PUBLISH from .*testtopic.*\(4 bytes\)"
 
   Scenario: If the MQTT broker does not exist, then no flow files are processed
     Given a GetFile processor with the "Input Directory" property set to "/tmp/input"
@@ -60,7 +60,7 @@ Feature: Sending data to MQTT streaming platform using PublishMQTT
 
     And an MQTT broker is deployed in correspondence with the PublishMQTT
     And a flowfile with the content "test" is placed in the monitored directory in less than 60 seconds
-    And the MQTT broker has a log line matching "Received PUBLISH from .*testtopic.*\\(4 bytes\\)"
+    And the MQTT broker has a log line matching "Received PUBLISH from .*testtopic.*\(4 bytes\)"
 
   Scenario: A MiNiFi instance publishes and consumes data to/from an MQTT broker
     Given a GetFile processor with the "Input Directory" property set to "/tmp/input"
@@ -77,5 +77,5 @@ Feature: Sending data to MQTT streaming platform using PublishMQTT
 
     When both instances start up
     Then a flowfile with the content "test" is placed in the monitored directory in less than 60 seconds
-    And the MQTT broker has a log line matching "Received PUBLISH from .*testtopic.*\\(4 bytes\\)"
+    And the MQTT broker has a log line matching "Received PUBLISH from .*testtopic.*\(4 bytes\)"
     And the MQTT broker has a log line matching "Received SUBSCRIBE from"
diff --git a/docker/test/integration/steps/steps.py b/docker/test/integration/steps/steps.py
index ac00506..8f1b614 100644
--- a/docker/test/integration/steps/steps.py
+++ b/docker/test/integration/steps/steps.py
@@ -744,12 +744,12 @@ def step_impl(context, log_message, duration):
 # MQTT
 @then("the MQTT broker has a log line matching \"{log_pattern}\"")
 def step_impl(context, log_pattern):
-    context.test.wait_for_container_logs('mqtt-broker', log_pattern, 30, count=1)
+    context.test.check_container_log_matches_regex('mqtt-broker', log_pattern, 30, count=1)
 
 
 @then("the \"{minifi_container_name}\" flow has a log line matching \"{log_pattern}\" in less than {duration}")
 def step_impl(context, minifi_container_name, log_pattern, duration):
-    context.test.wait_for_container_logs(minifi_container_name, log_pattern, timeparse(duration), count=1)
+    context.test.check_container_log_matches_regex(minifi_container_name, log_pattern, timeparse(duration), count=1)
 
 
 @then("an MQTT broker is deployed in correspondence with the PublishMQTT")