Skip to content

Commit 4efd1d6

Browse files
committed
MINIFICPP-2687 Move Python extension docker tests to modular docker tests
1 parent ff1088c commit 4efd1d6

File tree

55 files changed

+376
-938
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+376
-938
lines changed

behave_framework/src/minifi_test_framework/containers/minifi_container.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def deploy(self) -> bool:
8585
finished_str = "MiNiFi started"
8686
return wait_for_condition(
8787
condition=lambda: finished_str in self.get_logs(),
88-
timeout_seconds=15,
88+
timeout_seconds=300,
8989
bail_condition=lambda: self.exited,
9090
context=None)
9191

@@ -147,9 +147,11 @@ def _fill_default_properties(self):
147147
if self.is_fhs:
148148
self.properties["nifi.flow.configuration.file"] = "/etc/nifi-minifi-cpp/config.yml"
149149
self.properties["nifi.extension.path"] = "/usr/lib64/nifi-minifi-cpp/extensions/*"
150+
self.properties["nifi.python.processor.dir"] = '/var/lib/nifi-minifi-cpp/minifi-python'
150151
else:
151152
self.properties["nifi.flow.configuration.file"] = "./conf/config.yml"
152153
self.properties["nifi.extension.path"] = "../extensions/*"
154+
self.properties["nifi.python.processor.dir"] = '/opt/minifi/minifi-current/minifi-python'
153155
self.properties["nifi.administrative.yield.duration"] = "1 sec"
154156
self.properties["nifi.bored.yield.duration"] = "100 millis"
155157
self.properties["nifi.openssl.fips.support.enable"] = "false"
@@ -248,3 +250,9 @@ def create_debug_bundle(self) -> bool:
248250

249251
(code, _) = self.exec_run(["test", "-f", "/tmp/debug.tar.gz"])
250252
return code == 0
253+
254+
def add_example_python_processors(self):
255+
run_minifi_cmd = '/opt/minifi/minifi-current/bin/minifi.sh run' if not self.is_fhs else '/usr/bin/minifi'
256+
minifi_python_dir_path = '/opt/minifi/minifi-current/minifi-python' if not self.is_fhs else '/var/lib/nifi-minifi-cpp/minifi-python'
257+
minifi_python_examples = '/opt/minifi/minifi-current/minifi-python-examples' if not self.is_fhs else '/usr/share/doc/nifi-minifi-cpp/pythonprocessor-examples'
258+
self.command = f'sh -c "cp -r {minifi_python_examples} {minifi_python_dir_path}/examples && {run_minifi_cmd}"'

behave_framework/src/minifi_test_framework/steps/checking_steps.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def step_impl(context: MinifiTestContext, container_name: str, content: str, dir
4444

4545

4646
@then('a single file with the content "{content}" is placed in the "{directory}" directory in less than {duration}')
47+
@then("a single file with the content '{content}' is placed in the '{directory}' directory in less than {duration}")
4748
def step_impl(context: MinifiTestContext, content: str, directory: str, duration: str):
4849
context.execute_steps(f'then in the "{DEFAULT_MINIFI_CONTAINER_NAME}" container a single file with the content "{content}" is placed in the "{directory}" directory in less than {duration}')
4950

@@ -57,6 +58,7 @@ def step_impl(context: MinifiTestContext, container_name: str, content: str, dir
5758

5859

5960
@then('at least one file with the content "{content}" is placed in the "{directory}" directory in less than {duration}')
61+
@then("at least one file with the content '{content}' is placed in the '{directory}' directory in less than {duration}")
6062
def step_impl(context: MinifiTestContext, content: str, directory: str, duration: str):
6163
context.execute_steps(f'then in the "{DEFAULT_MINIFI_CONTAINER_NAME}" container at least one file with the content "{content}" is placed in the "{directory}" directory in less than {duration}')
6264

@@ -171,6 +173,16 @@ def step_impl(context: MinifiTestContext, directory: str, timeout: str, contents
171173
context=context)
172174

173175

176+
@then('files with at least these contents "{contents}" are placed in the "{directory}" directory in less than {timeout}')
177+
def step_impl(context: MinifiTestContext, directory: str, timeout: str, contents: str):
178+
timeout_seconds = humanfriendly.parse_timespan(timeout)
179+
new_contents = contents.replace("\\n", "\n")
180+
contents_arr = new_contents.split(",")
181+
assert wait_for_condition(condition=lambda: all([context.containers[DEFAULT_MINIFI_CONTAINER_NAME].directory_contains_file_with_content(directory, content) for content in contents_arr]),
182+
timeout_seconds=timeout_seconds, bail_condition=lambda: context.containers[DEFAULT_MINIFI_CONTAINER_NAME].exited,
183+
context=context)
184+
185+
174186
@then("a file with the JSON content \"{content}\" is placed in the \"{directory}\" directory in less than {duration}")
175187
@then("a file with the JSON content '{content}' is placed in the '{directory}' directory in less than {duration}")
176188
def step_impl(context: MinifiTestContext, content: str, directory: str, duration: str):

docker/RunBehaveTests.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,4 +209,5 @@ exec \
209209
"${docker_dir}/../extensions/lua/tests/features/" \
210210
"${docker_dir}/../extensions/civetweb/tests/features/" \
211211
"${docker_dir}/../extensions/mqtt/tests/features/" \
212-
"${docker_dir}/../extensions/prometheus/tests/features/"
212+
"${docker_dir}/../extensions/prometheus/tests/features/" \
213+
"${docker_dir}/../extensions/python/tests/features/"

docker/test/integration/cluster/ContainerStore.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -191,21 +191,6 @@ def set_ssl_context_properties_in_minifi(self):
191191
def enable_sql_in_minifi(self):
192192
self.minifi_options.enable_sql = True
193193

194-
def use_nifi_python_processors_with_system_python_packages_installed_in_minifi(self):
195-
self.minifi_options.use_nifi_python_processors_with_system_python_packages_installed = True
196-
197-
def use_nifi_python_processors_with_virtualenv_in_minifi(self):
198-
self.minifi_options.use_nifi_python_processors_with_virtualenv = True
199-
200-
def use_nifi_python_processors_with_virtualenv_packages_installed_in_minifi(self):
201-
self.minifi_options.use_nifi_python_processors_with_virtualenv_packages_installed = True
202-
203-
def remove_python_requirements_txt_in_minifi(self):
204-
self.minifi_options.remove_python_requirements_txt = True
205-
206-
def use_nifi_python_processors_without_dependencies_in_minifi(self):
207-
self.minifi_options.use_nifi_python_processors_without_dependencies = True
208-
209194
def set_yaml_in_minifi(self):
210195
self.minifi_options.config_format = "yaml"
211196

@@ -215,9 +200,6 @@ def set_json_in_minifi(self):
215200
def enable_log_metrics_publisher_in_minifi(self):
216201
self.minifi_options.enable_log_metrics_publisher = True
217202

218-
def enable_example_minifi_python_processors(self):
219-
self.minifi_options.enable_example_minifi_python_processors = True
220-
221203
def enable_openssl_fips_mode_in_minifi(self):
222204
self.minifi_options.enable_openssl_fips_mode = True
223205

docker/test/integration/cluster/DockerTestCluster.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -86,21 +86,6 @@ def disable_openssl_fips_mode_in_minifi(self):
8686
def enable_sql_in_minifi(self):
8787
self.container_store.enable_sql_in_minifi()
8888

89-
def use_nifi_python_processors_with_system_python_packages_installed_in_minifi(self):
90-
self.container_store.use_nifi_python_processors_with_system_python_packages_installed_in_minifi()
91-
92-
def use_nifi_python_processors_with_virtualenv_in_minifi(self):
93-
self.container_store.use_nifi_python_processors_with_virtualenv_in_minifi()
94-
95-
def use_nifi_python_processors_with_virtualenv_packages_installed_in_minifi(self):
96-
self.container_store.use_nifi_python_processors_with_virtualenv_packages_installed_in_minifi()
97-
98-
def remove_python_requirements_txt_in_minifi(self):
99-
self.container_store.remove_python_requirements_txt_in_minifi()
100-
101-
def use_nifi_python_processors_without_dependencies_in_minifi(self):
102-
self.container_store.use_nifi_python_processors_without_dependencies_in_minifi()
103-
10489
def set_yaml_in_minifi(self):
10590
self.container_store.set_yaml_in_minifi()
10691

@@ -110,9 +95,6 @@ def set_json_in_minifi(self):
11095
def enable_log_metrics_publisher_in_minifi(self):
11196
self.container_store.enable_log_metrics_publisher_in_minifi()
11297

113-
def enable_example_minifi_python_processors(self):
114-
self.container_store.enable_example_minifi_python_processors()
115-
11698
def llama_model_is_downloaded_in_minifi(self):
11799
self.container_store.llama_model_is_downloaded_in_minifi()
118100

docker/test/integration/cluster/DockerTestDirectoryBindings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ def create_new_data_directories(self):
5454

5555
# Add resources
5656
test_dir = os.environ['TEST_DIRECTORY'] # Based on DockerVerify.sh
57-
shutil.copytree(test_dir + "/resources/python", self.data_directories[self.feature_id]["resources_dir"] + "/python")
5857
shutil.copytree(test_dir + "/resources/minifi", self.data_directories[self.feature_id]["minifi_config_dir"], dirs_exist_ok=True)
5958

6059
def get_data_directories(self):

0 commit comments

Comments
 (0)