hunyadi-dev commented on a change in pull request #1053:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1053#discussion_r617226321
##########
File path: docker/test/integration/minifi/validators/FileOutputValidator.py
##########
@@ -1,8 +1,46 @@
+import logging
+import os
+
+from os import listdir
+from os.path import join
+
from .OutputValidator import OutputValidator
class FileOutputValidator(OutputValidator):
def set_output_dir(self, output_dir):
self.output_dir = output_dir
+ @staticmethod
+ def num_files_matching_content_in_dir(dir_path, expected_content):
+ listing = listdir(dir_path)
+ if listing:
+ files_of_matching_content_found = 0
+ for file_name in listing:
+ full_path = join(dir_path, file_name)
+ if not os.path.isfile(full_path):
+ continue
+ with open(full_path, 'r') as out_file:
+ contents = out_file.read()
+ logging.info("dir %s -- name %s", dir_path, file_name)
+ logging.info("expected content: %s -- actual: %s, match: %r",
expected_content, contents, expected_content == contents)
+ if expected_content in contents:
+ files_of_matching_content_found += 1
+ return files_of_matching_content_found
+ return 0
+
+ @staticmethod
+ def get_num_files(dir_path):
+ listing = listdir(dir_path)
+ logging.info("Num files in %s: %d", dir_path, len(listing))
+ if listing:
Review comment:
Updated.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]