You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "lordgamez (via GitHub)" <gi...@apache.org> on 2026/01/22 13:20:35 UTC
[PR] MINIFICPP-2685 Move MQTT tests to modular docker tests [nifi-minifi-cpp]
lordgamez opened a new pull request, #2091:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2091
https://issues.apache.org/jira/browse/MINIFICPP-2685
Depends on https://github.com/apache/nifi-minifi-cpp/pull/2089
---------------------
Thank you for submitting a contribution to Apache NiFi - MiNiFi C++.
In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:
### For all changes:
- [ ] Is there a JIRA ticket associated with this PR? Is it referenced
in the commit message?
- [ ] Does your PR title start with MINIFICPP-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
- [ ] Has your PR been rebased against the latest commit within the target branch (typically main)?
- [ ] Is your initial contribution a single, squashed commit?
### For code changes:
- [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
- [ ] If applicable, have you updated the LICENSE file?
- [ ] If applicable, have you updated the NOTICE file?
### For documentation related changes:
- [ ] Have you ensured that format looks appropriate for the output in which it is rendered?
### Note:
Please ensure that once the PR is submitted, you check GitHub Actions CI results for build issues and submit an update to your PR as soon as possible.
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MINIFICPP-2685 Move MQTT tests to modular docker tests [nifi-minifi-cpp]
Posted by "lordgamez (via GitHub)" <gi...@apache.org>.
lordgamez closed pull request #2091: MINIFICPP-2685 Move MQTT tests to modular docker tests
URL: https://github.com/apache/nifi-minifi-cpp/pull/2091
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MINIFICPP-2685 Move MQTT tests to modular docker tests [nifi-minifi-cpp]
Posted by "fgerlits (via GitHub)" <gi...@apache.org>.
fgerlits commented on code in PR #2091:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2091#discussion_r2794282630
##########
behave_framework/src/minifi_test_framework/containers/container.py:
##########
@@ -50,6 +51,23 @@ def __init__(self, image_name: str, container_name: str, network: Network, comma
def add_host_file(self, host_path: str, container_path: str, mode: str = "ro"):
self.host_files.append(HostFile(container_path, host_path, mode))
+ def add_file_to_running_container(self, content: str, path: str):
+ if not self.container:
+ logging.error("Container is not running. Cannot add file.")
+ raise RuntimeError("Container is not running. Cannot add file.")
+
+ mkdir_command = f"mkdir -p {shlex.quote(path)}"
+ exit_code, output = self.exec_run(mkdir_command)
+ if exit_code != 0:
+ logging.error(f"Error creating directory '{path}' in container: {output}")
+ raise RuntimeError(f"Error creating directory '{path}' in container: {output}")
+
+ file_name = str(uuid.uuid4())
+ exit_code, output = self.exec_run(f"sh -c \"printf %s '{content}' > {os.path.join(path, file_name)}\"")
Review Comment:
`content` may contain quote characters, so it's better to use `shlex.quote`:
```suggestion
full_path = os.path.join(path, file_name)
pipe_command = f"printf %s {shlex.quote(content)} > {shlex.quote(full_path)}"
exit_code, output = self.exec_run(f"sh -c {shlex.quote(pipe_command)}")
```
##########
behave_framework/src/minifi_test_framework/steps/core_steps.py:
##########
@@ -95,11 +112,31 @@ def step_impl(context: MinifiTestContext):
context.get_or_create_default_minifi_container().stop()
+@when("\"{container_name}\" flow is stopped")
Review Comment:
nitpicking, but I would add a "the":
```suggestion
@when("the \"{container_name}\" flow is stopped")
```
##########
extensions/mqtt/tests/features/steps/mqtt_broker_container.py:
##########
@@ -0,0 +1,63 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import logging
+import re
+from textwrap import dedent
+
+from minifi_test_framework.containers.container import Container
+from minifi_test_framework.core.helpers import wait_for_condition
+from minifi_test_framework.core.minifi_test_context import MinifiTestContext
+from minifi_test_framework.containers.docker_image_builder import DockerImageBuilder
+from docker.errors import ContainerError
+
+
+class MqttBrokerContainer(Container):
+ def __init__(self, test_context: MinifiTestContext):
+ dockerfile = dedent("""\
+ FROM {base_image}
+ RUN echo 'log_dest stderr' >> /mosquitto-no-auth.conf
+ CMD ["/usr/sbin/mosquitto", "--verbose", "--config-file", "/mosquitto-no-auth.conf"]
+ """.format(base_image='eclipse-mosquitto:2.0.14'))
Review Comment:
we could upgrade this to the latest patch version, 2.0.22, if there are no breaking changes
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MINIFICPP-2685 Move MQTT tests to modular docker tests [nifi-minifi-cpp]
Posted by "lordgamez (via GitHub)" <gi...@apache.org>.
lordgamez commented on code in PR #2091:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2091#discussion_r2797756414
##########
behave_framework/src/minifi_test_framework/containers/container.py:
##########
@@ -50,6 +51,23 @@ def __init__(self, image_name: str, container_name: str, network: Network, comma
def add_host_file(self, host_path: str, container_path: str, mode: str = "ro"):
self.host_files.append(HostFile(container_path, host_path, mode))
+ def add_file_to_running_container(self, content: str, path: str):
+ if not self.container:
+ logging.error("Container is not running. Cannot add file.")
+ raise RuntimeError("Container is not running. Cannot add file.")
+
+ mkdir_command = f"mkdir -p {shlex.quote(path)}"
+ exit_code, output = self.exec_run(mkdir_command)
+ if exit_code != 0:
+ logging.error(f"Error creating directory '{path}' in container: {output}")
+ raise RuntimeError(f"Error creating directory '{path}' in container: {output}")
+
+ file_name = str(uuid.uuid4())
+ exit_code, output = self.exec_run(f"sh -c \"printf %s '{content}' > {os.path.join(path, file_name)}\"")
Review Comment:
Updated in https://github.com/apache/nifi-minifi-cpp/pull/2091/commits/7fbce69752eac921b6cc10cbb85cffb650eed5dc
##########
behave_framework/src/minifi_test_framework/steps/core_steps.py:
##########
@@ -95,11 +112,31 @@ def step_impl(context: MinifiTestContext):
context.get_or_create_default_minifi_container().stop()
+@when("\"{container_name}\" flow is stopped")
Review Comment:
Updated in https://github.com/apache/nifi-minifi-cpp/pull/2091/commits/7fbce69752eac921b6cc10cbb85cffb650eed5dc
##########
extensions/mqtt/tests/features/steps/mqtt_broker_container.py:
##########
@@ -0,0 +1,63 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import logging
+import re
+from textwrap import dedent
+
+from minifi_test_framework.containers.container import Container
+from minifi_test_framework.core.helpers import wait_for_condition
+from minifi_test_framework.core.minifi_test_context import MinifiTestContext
+from minifi_test_framework.containers.docker_image_builder import DockerImageBuilder
+from docker.errors import ContainerError
+
+
+class MqttBrokerContainer(Container):
+ def __init__(self, test_context: MinifiTestContext):
+ dockerfile = dedent("""\
+ FROM {base_image}
+ RUN echo 'log_dest stderr' >> /mosquitto-no-auth.conf
+ CMD ["/usr/sbin/mosquitto", "--verbose", "--config-file", "/mosquitto-no-auth.conf"]
+ """.format(base_image='eclipse-mosquitto:2.0.14'))
Review Comment:
Updated in https://github.com/apache/nifi-minifi-cpp/pull/2091/commits/7fbce69752eac921b6cc10cbb85cffb650eed5dc
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MINIFICPP-2685 Move MQTT tests to modular docker tests [nifi-minifi-cpp]
Posted by "fgerlits (via GitHub)" <gi...@apache.org>.
fgerlits commented on code in PR #2091:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2091#discussion_r2797816841
##########
extensions/mqtt/tests/features/steps/mqtt_broker_container.py:
##########
@@ -0,0 +1,63 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import logging
+import re
+from textwrap import dedent
+
+from minifi_test_framework.containers.container import Container
+from minifi_test_framework.core.helpers import wait_for_condition
+from minifi_test_framework.core.minifi_test_context import MinifiTestContext
+from minifi_test_framework.containers.docker_image_builder import DockerImageBuilder
+from docker.errors import ContainerError
+
+
+class MqttBrokerContainer(Container):
+ def __init__(self, test_context: MinifiTestContext):
+ dockerfile = dedent("""\
+ FROM {base_image}
+ RUN echo 'log_dest stderr' >> /mosquitto-no-auth.conf
+ CMD ["/usr/sbin/mosquitto", "--verbose", "--config-file", "/mosquitto-no-auth.conf"]
+ """.format(base_image='eclipse-mosquitto:2.0.14'))
Review Comment:
thanks, `2.1.1-alpine` is even better, if it works
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org