adamdebreceni commented on code in PR #1461:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1461#discussion_r1073705141


##########
docker/test/integration/cluster/checkers/PostgresChecker.py:
##########
@@ -0,0 +1,18 @@
+import time
+
+
+class PostgresChecker:
+    def __init__(self, container_communicator):
+        self.container_communicator = container_communicator
+
+    def __query_postgres_server(self, postgresql_container_name, query, 
number_of_rows):
+        (code, output) = 
self.container_communicator.execute_command(postgresql_container_name, ["psql", 
"-U", "postgres", "-c", query])
+        return code == 0 and str(number_of_rows) + " rows" in output
+
+    def check_query_results(self, postgresql_container_name, query, 
number_of_rows, timeout_seconds):
+        start_time = time.perf_counter()
+        while (time.perf_counter() - start_time) < timeout_seconds:
+            if self.__query_postgres_server(postgresql_container_name, query, 
number_of_rows):
+                return True
+            time.sleep(2)
+        return False

Review Comment:
   could we use the `retry_check` wrapper for this method?



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