hunyadi-dev commented on a change in pull request #995: URL: https://github.com/apache/nifi-minifi-cpp/pull/995#discussion_r572724334
########## File path: docker/test/integration/minifi/core/Processor.py ########## @@ -37,6 +39,16 @@ def __init__(self, } self.schedule.update(schedule) + def set_property(self, key, value): + # if value == "false": + # self.properties[key] = False + # if value == "true": + # self.properties[key] = True Review comment: Removed. ########## File path: docker/test/integration/minifi/core/DockerTestDirectoryBindings.py ########## @@ -0,0 +1,104 @@ +import logging +import os +import shutil + +class DockerTestDirectoryBindings: + def __init__(self): + self.data_directories = {} + + def __del__(self): + self.delete_data_directories() + + def create_new_data_directories(self, test_id): + self.data_directories[test_id] = { + "input_dir": "/tmp/.nifi-test-input." + test_id, + "output_dir": "/tmp/.nifi-test-output." + test_id, + "resources_dir": "/tmp/.nifi-test-resources." + test_id + } + + [self.create_directory(directory) for directory in self.data_directories[test_id].values()] + + # Add resources + test_dir = os.environ['PYTHONPATH'].split(':')[-1] # Based on DockerVerify.sh + shutil.copytree(test_dir + "/resources/kafka_broker/conf/certs", self.data_directories[test_id]["resources_dir"] + "/certs") + + def get_data_directories(self, test_id): + return self.data_directories[test_id] + + def docker_path_to_local_path(self, test_id, docker_path): + # Docker paths are currently hard-coded + if docker_path == "/tmp/input": + return self.data_directories[test_id]["input_dir"] + if docker_path == "/tmp/output": + return self.data_directories[test_id]["output_dir"] + if docker_path == "/tmp/resources": + return self.data_directories[test_id]["resources_dir"] + # Might be worth reworking these + if docker_path == "/tmp/output/success": + self.create_directory(self.data_directories[test_id]["output_dir"] + "/success") + return self.data_directories[test_id]["output_dir"] + "/success" + if docker_path == "/tmp/output/failure": + self.create_directory(self.data_directories[test_id]["output_dir"] + "/failure") + return self.data_directories[test_id]["output_dir"] + "/failure" + raise Exception("Docker directory \"%s\" has no preset bindings." % docker_path) + + def get_directory_bindings(self, test_id): + """ + Performs a standard container flow deployment with the addition + of volumes supporting test input/output directories. + """ + vols = {} + vols[self.data_directories[test_id]["input_dir"]] = {"bind": "/tmp/input", "mode": "rw"} + vols[self.data_directories[test_id]["output_dir"]] = {"bind": "/tmp/output", "mode": "rw"} + vols[self.data_directories[test_id]["resources_dir"]] = {"bind": "/tmp/resources", "mode": "rw"} + return vols + + @staticmethod + def create_directory(dir): + logging.info("Creating tmp dir: %s", dir) + os.makedirs(dir) + os.chmod(dir, 0o777) + + @staticmethod + def delete_directory(dir): Review comment: Renamed. ---------------------------------------------------------------- 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: us...@infra.apache.org