lordgamez commented on code in PR #1456:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1456#discussion_r1033754099


##########
docker/test/integration/MiNiFi_integration_test_driver.py:
##########
@@ -311,3 +311,9 @@ def check_metric_class_on_prometheus(self, metric_class, 
timeout_seconds):
 
     def check_processor_metric_on_prometheus(self, metric_class, 
timeout_seconds, processor_name):
         assert 
self.cluster.wait_for_processor_metric_on_prometheus(metric_class, 
timeout_seconds, processor_name)
+
+    def check_minimum_peak_memory_usage(self, minimum_peak_memory_usage: int, 
timeout_seconds: int):

Review Comment:
   :+1: I was not brave enough yet to introduce type hints



##########
docker/test/integration/minifi/core/DockerTestCluster.py:
##########
@@ -318,3 +318,25 @@ def wait_for_metric_class_on_prometheus(self, 
metric_class, timeout_seconds):
 
     def wait_for_processor_metric_on_prometheus(self, metric_class, 
timeout_seconds, processor_name):
         return 
PrometheusChecker().wait_for_processor_metric_on_prometheus(metric_class, 
timeout_seconds, processor_name)
+
+    def wait_for_peak_memory_usage(self, minimum_peak_memory_usage: int, 
timeout_seconds: int) -> bool:
+        start_time = time.perf_counter()
+        current_peak_memory_usage = get_peak_memory_usage(get_minifi_pid())
+        while (time.perf_counter() - start_time) < timeout_seconds:
+            if current_peak_memory_usage > minimum_peak_memory_usage:

Review Comment:
   Shouldn't we check if `current_peak_memory_usage` is None as the function 
returns Optional? Same for `wait_for_maximum_memory_usage`



##########
docker/test/integration/minifi/core/DockerTestCluster.py:
##########
@@ -318,3 +318,25 @@ def wait_for_metric_class_on_prometheus(self, 
metric_class, timeout_seconds):
 
     def wait_for_processor_metric_on_prometheus(self, metric_class, 
timeout_seconds, processor_name):
         return 
PrometheusChecker().wait_for_processor_metric_on_prometheus(metric_class, 
timeout_seconds, processor_name)
+
+    def wait_for_peak_memory_usage(self, minimum_peak_memory_usage: int, 
timeout_seconds: int) -> bool:
+        start_time = time.perf_counter()
+        current_peak_memory_usage = get_peak_memory_usage(get_minifi_pid())
+        while (time.perf_counter() - start_time) < timeout_seconds:
+            if current_peak_memory_usage > minimum_peak_memory_usage:
+                return True
+            current_peak_memory_usage = get_peak_memory_usage(get_minifi_pid())
+            time.sleep(1)
+        print(f"Peak memory usage ({current_peak_memory_usage}) didnt exceed 
minimum asserted peak memory usage {minimum_peak_memory_usage}")

Review Comment:
   I think we shold use the `logging` library instead, same for 
`wait_for_maximum_memory_usage`



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