This is an automated email from the ASF dual-hosted git repository. martinzink pushed a commit to branch minifi_behave_impr in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git
commit e80894da056798be10a5ac54ab5b60ded82f27f8 Author: Martin Zink <[email protected]> AuthorDate: Wed Aug 19 15:02:32 2026 +0200 rebase --- .../src/minifi_behave/containers/container_linux.py | 8 ++------ behave_framework/src/minifi_behave/core/hooks.py | 12 +++--------- behave_framework/src/minifi_behave/steps/core_steps.py | 12 +++--------- .../src/minifi_behave/steps/flow_building_steps.py | 12 +++--------- 4 files changed, 11 insertions(+), 33 deletions(-) diff --git a/behave_framework/src/minifi_behave/containers/container_linux.py b/behave_framework/src/minifi_behave/containers/container_linux.py index b8ae10279..034f53c69 100644 --- a/behave_framework/src/minifi_behave/containers/container_linux.py +++ b/behave_framework/src/minifi_behave/containers/container_linux.py @@ -122,18 +122,14 @@ class LinuxContainer(ContainerProtocol): def _configure_volumes_of_host_copies(self): groups: dict[str, list[tuple[str, str]]] = defaultdict(list) for host_path, container_path in self._pending_host_copies: - groups[os.path.dirname(container_path)].append( - (host_path, os.path.basename(container_path)) - ) + groups[os.path.dirname(container_path)].append((host_path, os.path.basename(container_path))) for container_dir, entries in groups.items(): temp_path = self._temp_dir.name + container_dir os.makedirs(temp_path, exist_ok=True) for host_path, filename in entries: with open(host_path, "rb") as f: content = f.read() - self._write_content_to_file( - os.path.join(temp_path, filename), None, content - ) + self._write_content_to_file(os.path.join(temp_path, filename), None, content) self.volumes[temp_path] = {"bind": container_dir, "mode": "rw"} def deploy(self, context: MinifiTestContext | None) -> bool: diff --git a/behave_framework/src/minifi_behave/core/hooks.py b/behave_framework/src/minifi_behave/core/hooks.py index 0d4f7be51..7ed8754ac 100644 --- a/behave_framework/src/minifi_behave/core/hooks.py +++ b/behave_framework/src/minifi_behave/core/hooks.py @@ -112,16 +112,12 @@ def common_after_scenario(context: MinifiTestContext, scenario: Scenario): context.network.remove() -def add_extension_to_minifi_container( - extension_name: str, possible_paths: list[str], context: MinifiTestContext -): +def add_extension_to_minifi_container(extension_name: str, possible_paths: list[str], context: MinifiTestContext): new_container_name = f"apacheminificpp:{extension_name}" is_windows = os.name == "nt" if is_windows: lib_filename = f"{extension_name}.dll" - container_extension_dir = ( - "C:/Program Files/ApacheNiFiMiNiFi/nifi-minifi-cpp/extensions" - ) + container_extension_dir = "C:/Program Files/ApacheNiFiMiNiFi/nifi-minifi-cpp/extensions" else: lib_filename = f"lib{extension_name}.so" container_extension_dir = "/opt/minifi/minifi-current/extensions/" @@ -132,9 +128,7 @@ def add_extension_to_minifi_container( host_path = os.path.join(path, lib_filename) break - assert host_path is not None, ( - f"Could not find {lib_filename} in {[p for p in possible_paths]}" - ) + assert host_path is not None, f"Could not find {lib_filename} in {[p for p in possible_paths]}" with open(host_path, "rb") as f: lib_content = f.read() diff --git a/behave_framework/src/minifi_behave/steps/core_steps.py b/behave_framework/src/minifi_behave/steps/core_steps.py index 75c63d5f8..3e698ee0d 100644 --- a/behave_framework/src/minifi_behave/steps/core_steps.py +++ b/behave_framework/src/minifi_behave/steps/core_steps.py @@ -182,17 +182,11 @@ def copy_host_resource_file_to_container_path_for_container( context: MinifiTestContext, filename: str, container_path: str, container_name: str ): path = os.path.join(context.resource_dir, filename) - context.get_or_create_minifi_container(container_name).add_host_file_as_copy( - path, container_path - ) + context.get_or_create_minifi_container(container_name).add_host_file_as_copy(path, container_path) -@given( - 'a host resource file "{filename}" is copied to the "{container_path}" path in the MiNiFi container' -) -def copy_host_resource_file_to_container_path( - context: MinifiTestContext, filename: str, container_path: str -): +@given('a host resource file "{filename}" is copied to the "{container_path}" path in the MiNiFi container') +def copy_host_resource_file_to_container_path(context: MinifiTestContext, filename: str, container_path: str): context.execute_steps( f'given a host resource file "{filename}" is copied to the "{container_path}" path in the MiNiFi container "{DEFAULT_MINIFI_CONTAINER_NAME}"' ) diff --git a/behave_framework/src/minifi_behave/steps/flow_building_steps.py b/behave_framework/src/minifi_behave/steps/flow_building_steps.py index 736490977..29b8a6876 100644 --- a/behave_framework/src/minifi_behave/steps/flow_building_steps.py +++ b/behave_framework/src/minifi_behave/steps/flow_building_steps.py @@ -68,9 +68,7 @@ def processor_with_name_and_property( context.get_or_create_default_minifi_container().flow_definition.add_processor(processor) -@step( - 'an {processor_type} processor with the "{property_name}" property set to "{property_value}"' -) +@step('an {processor_type} processor with the "{property_name}" property set to "{property_value}"') @step('a {processor_type} processor with the "{property_name}" property set to "{property_value}"') def processor_with_property( context: MinifiTestContext, @@ -101,9 +99,7 @@ def processor_with_property_in_minifi_flow( context.get_or_create_minifi_container(minifi_container_name).flow_definition.add_processor(processor) -@step( - 'an {processor_type} processor with the "{property_name}" property set to "{property_value}" in the NiFi flow' -) +@step('an {processor_type} processor with the "{property_name}" property set to "{property_value}" in the NiFi flow') @step('a {processor_type} processor with the "{property_name}" property set to "{property_value}" in the NiFi flow') def processor_with_property_in_nifi_flow( context: MinifiTestContext, @@ -116,9 +112,7 @@ def processor_with_property_in_nifi_flow( context.containers["nifi"].flow_definition.add_processor(processor) -@given( - 'an {processor_type} processor with the name "{processor_name}" in the "{minifi_container_name}" flow' -) +@given('an {processor_type} processor with the name "{processor_name}" in the "{minifi_container_name}" flow') @given('a {processor_type} processor with the name "{processor_name}" in the "{minifi_container_name}" flow') def processor_with_name_in_minifi_flow( context: MinifiTestContext,
