This is an automated email from the ASF dual-hosted git repository. szaszm pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git
commit 18dbb895521f8d17817ed79104e893a76d23f98e Author: Gabor Gyimesi <[email protected]> AuthorDate: Tue Mar 17 20:28:05 2026 +0100 MINIFICPP-2747 Fix flaky MQTT tests When input files are created in the test environment after the MiNiFi container is started, it is possible that the GetFile reads the newly created file before its content is added resulting in an empty flowfile. This fix solves the issue by creating the temporary input file first and moving that file to the input directory afterwards. Example failure: https://github.com/apache/nifi-minifi-cpp/actions/runs/22993038477/attempts/1 Closes #2134 Signed-off-by: Marton Szasz <[email protected]> --- behave_framework/src/minifi_test_framework/containers/container.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/behave_framework/src/minifi_test_framework/containers/container.py b/behave_framework/src/minifi_test_framework/containers/container.py index 24f941319..6beababde 100644 --- a/behave_framework/src/minifi_test_framework/containers/container.py +++ b/behave_framework/src/minifi_test_framework/containers/container.py @@ -69,7 +69,8 @@ class Container: raise RuntimeError(f"Error creating directory '{path}' in container: {output}") full_path = os.path.join(path, str(uuid.uuid4())) - pipe_command = f"printf %s {shlex.quote(content)} > {shlex.quote(full_path)}" + tmp_path = os.path.join("/tmp", str(uuid.uuid4())) + pipe_command = f"printf %s {shlex.quote(content)} > {shlex.quote(tmp_path)} && mv {shlex.quote(tmp_path)} {shlex.quote(full_path)}" exit_code, output = self.exec_run(f"sh -c {shlex.quote(pipe_command)}") if exit_code != 0: logging.error(f"Error adding file to running container: {output}")
