You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ma...@apache.org on 2026/02/19 15:51:45 UTC
(nifi-minifi-cpp) 01/04: MINIFICPP-2711 Docker tests, missing logs if container fails to start #2099
This is an automated email from the ASF dual-hosted git repository.
martinzink pushed a commit to branch apache-rusty
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git
commit 2da8c20d0f5e728fa2cd90e7a7db0d1a0ef2bca8
Author: Martin Zink <ma...@apache.org>
AuthorDate: Thu Feb 19 16:46:30 2026 +0100
MINIFICPP-2711 Docker tests, missing logs if container fails to start #2099
---
.../src/minifi_test_framework/containers/container.py | 8 +++++++-
.../src/minifi_test_framework/containers/http_proxy_container.py | 6 +++---
.../src/minifi_test_framework/containers/minifi_container.py | 6 +++---
.../src/minifi_test_framework/containers/nifi_container.py | 6 +++---
behave_framework/src/minifi_test_framework/steps/core_steps.py | 4 ++--
extensions/aws/tests/features/steps/kinesis_server_container.py | 6 +++---
extensions/aws/tests/features/steps/s3_server_container.py | 6 +++---
extensions/azure/tests/features/steps/azure_server_container.py | 6 +++---
extensions/azure/tests/features/steps/steps.py | 2 +-
.../couchbase/tests/features/steps/couchbase_server_container.py | 6 +++---
extensions/couchbase/tests/features/steps/steps.py | 2 +-
.../elasticsearch/tests/features/steps/elastic_base_container.py | 6 +++---
.../elasticsearch/tests/features/steps/elasticsearch_container.py | 4 ++--
.../elasticsearch/tests/features/steps/opensearch_container.py | 4 ++--
extensions/elasticsearch/tests/features/steps/steps.py | 4 ++--
extensions/gcp/tests/features/steps/fake_gcs_server_container.py | 6 +++---
extensions/gcp/tests/features/steps/steps.py | 2 +-
.../grafana-loki/tests/features/steps/grafana_loki_container.py | 6 +++---
.../grafana-loki/tests/features/steps/reverse_proxy_container.py | 6 +++---
extensions/kafka/tests/features/steps/kafka_server_container.py | 6 +++---
extensions/kafka/tests/features/steps/steps.py | 2 +-
extensions/opc/tests/features/steps/opc_ua_server_container.py | 6 +++---
extensions/splunk/tests/features/steps/splunk_container.py | 6 +++---
extensions/splunk/tests/features/steps/steps.py | 2 +-
extensions/sql/tests/features/steps/postgress_server_container.py | 7 ++++---
.../tests/features/steps/diag_slave_container.py | 6 +++---
extensions/standard-processors/tests/features/steps/steps.py | 2 +-
.../tests/features/steps/tcp_client_container.py | 6 +++---
28 files changed, 73 insertions(+), 66 deletions(-)
diff --git a/behave_framework/src/minifi_test_framework/containers/container.py b/behave_framework/src/minifi_test_framework/containers/container.py
index 8c59586f5..75660d785 100644
--- a/behave_framework/src/minifi_test_framework/containers/container.py
+++ b/behave_framework/src/minifi_test_framework/containers/container.py
@@ -14,6 +14,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+from __future__ import annotations
+from typing import TYPE_CHECKING
+
import json
import logging
import os
@@ -28,6 +31,9 @@ from minifi_test_framework.containers.directory import Directory
from minifi_test_framework.containers.file import File
from minifi_test_framework.containers.host_file import HostFile
+if TYPE_CHECKING:
+ from minifi_test_framework.core.minifi_test_context import MinifiTestContext
+
class Container:
def __init__(self, image_name: str, container_name: str, network: Network, command: str | None = None, entrypoint: str | None = None):
@@ -74,7 +80,7 @@ class Container:
self._write_content_to_file(file_path, None, content)
self.volumes[temp_path] = {"bind": directory.path, "mode": directory.mode}
- def deploy(self) -> bool:
+ def deploy(self, context: MinifiTestContext | None) -> bool:
self._temp_dir = tempfile.TemporaryDirectory()
self._configure_volumes_of_container_files()
self._configure_volumes_of_container_dirs()
diff --git a/behave_framework/src/minifi_test_framework/containers/http_proxy_container.py b/behave_framework/src/minifi_test_framework/containers/http_proxy_container.py
index d07c674ff..49ba2e766 100644
--- a/behave_framework/src/minifi_test_framework/containers/http_proxy_container.py
+++ b/behave_framework/src/minifi_test_framework/containers/http_proxy_container.py
@@ -46,14 +46,14 @@ class HttpProxy(Container):
super().__init__("minifi-http-proxy:latest", f"http-proxy-{test_context.scenario_id}", test_context.network)
- def deploy(self):
- super().deploy()
+ def deploy(self, context: MinifiTestContext | None) -> bool:
+ super().deploy(context)
finished_str = "Accepting HTTP Socket connections at"
return wait_for_condition(
condition=lambda: finished_str in self.get_logs(),
timeout_seconds=5,
bail_condition=lambda: self.exited,
- context=None
+ context=context
)
def check_http_proxy_access(self, url):
diff --git a/behave_framework/src/minifi_test_framework/containers/minifi_container.py b/behave_framework/src/minifi_test_framework/containers/minifi_container.py
index be72155e9..75415017f 100644
--- a/behave_framework/src/minifi_test_framework/containers/minifi_container.py
+++ b/behave_framework/src/minifi_test_framework/containers/minifi_container.py
@@ -59,7 +59,7 @@ class MinifiContainer(Container):
self._fill_default_properties()
self._fill_default_log_properties()
- def deploy(self) -> bool:
+ def deploy(self, context: MinifiTestContext | None) -> bool:
flow_config = self.flow_definition.to_yaml()
logging.info(f"Deploying MiNiFi container '{self.container_name}' with flow configuration:\n{flow_config}")
if self.is_fhs:
@@ -77,7 +77,7 @@ class MinifiContainer(Container):
resource_dir = Path(__file__).resolve().parent / "resources" / "minifi-controller"
self.host_files.append(HostFile("/tmp/resources/minifi-controller/config.yml", os.path.join(resource_dir, "config.yml")))
- if not super().deploy():
+ if not super().deploy(context):
return False
finished_str = "MiNiFi started"
@@ -85,7 +85,7 @@ class MinifiContainer(Container):
condition=lambda: finished_str in self.get_logs(),
timeout_seconds=15,
bail_condition=lambda: self.exited,
- context=None)
+ context=context)
def set_property(self, key: str, value: str):
self.properties[key] = value
diff --git a/behave_framework/src/minifi_test_framework/containers/nifi_container.py b/behave_framework/src/minifi_test_framework/containers/nifi_container.py
index 396b1e1a7..d40724de1 100644
--- a/behave_framework/src/minifi_test_framework/containers/nifi_container.py
+++ b/behave_framework/src/minifi_test_framework/containers/nifi_container.py
@@ -70,7 +70,7 @@ class NifiContainer(Container):
super().__init__("apache/nifi:" + self.NIFI_VERSION, name, test_context.network, entrypoint=command)
- def deploy(self):
+ def deploy(self, context: MinifiTestContext | None) -> bool:
flow_config = self.flow_definition.to_json()
buffer = io.BytesIO()
@@ -80,10 +80,10 @@ class NifiContainer(Container):
gzipped_bytes = buffer.getvalue()
self.files.append(File("/tmp/nifi_config/flow.json.gz", gzipped_bytes))
- super().deploy()
+ super().deploy(context)
finished_str = "Started Application in"
return wait_for_condition(
condition=lambda: finished_str in self.get_logs(),
timeout_seconds=300,
bail_condition=lambda: self.exited,
- context=None)
+ context=context)
diff --git a/behave_framework/src/minifi_test_framework/steps/core_steps.py b/behave_framework/src/minifi_test_framework/steps/core_steps.py
index 836b58834..95176f591 100644
--- a/behave_framework/src/minifi_test_framework/steps/core_steps.py
+++ b/behave_framework/src/minifi_test_framework/steps/core_steps.py
@@ -36,13 +36,13 @@ from minifi_test_framework.core.minifi_test_context import DEFAULT_MINIFI_CONTAI
@when("all instances start up")
def step_impl(context: MinifiTestContext):
for container in context.containers.values():
- assert container.deploy() or container.log_app_output()
+ assert container.deploy(context)
logging.debug("All instances started up")
@when("the MiNiFi instance starts up")
def step_impl(context: MinifiTestContext):
- assert context.get_or_create_default_minifi_container().deploy()
+ assert context.get_or_create_default_minifi_container().deploy(context)
logging.debug("MiNiFi instance started up")
diff --git a/extensions/aws/tests/features/steps/kinesis_server_container.py b/extensions/aws/tests/features/steps/kinesis_server_container.py
index e92b33c41..01b6dced2 100644
--- a/extensions/aws/tests/features/steps/kinesis_server_container.py
+++ b/extensions/aws/tests/features/steps/kinesis_server_container.py
@@ -34,14 +34,14 @@ class KinesisServerContainer(Container):
self.environment.append("INITIALIZE_STREAMS=test_stream:3")
self.environment.append("LOG_LEVEL=DEBUG")
- def deploy(self):
- super().deploy()
+ def deploy(self, context: MinifiTestContext | None) -> bool:
+ super().deploy(context)
finished_str = "Starting Kinesis Plain Mock Service on port 4568"
return wait_for_condition(
condition=lambda: finished_str in self.get_logs(),
timeout_seconds=300,
bail_condition=lambda: self.exited,
- context=None)
+ context=context)
@retry_check()
def check_kinesis_server_record_data(self, record_data):
diff --git a/extensions/aws/tests/features/steps/s3_server_container.py b/extensions/aws/tests/features/steps/s3_server_container.py
index 01db20030..699617c71 100644
--- a/extensions/aws/tests/features/steps/s3_server_container.py
+++ b/extensions/aws/tests/features/steps/s3_server_container.py
@@ -26,14 +26,14 @@ class S3ServerContainer(Container):
super().__init__("adobe/s3mock:3.12.0", f"s3-server-{test_context.scenario_id}", test_context.network)
self.environment.append("initialBuckets=test_bucket")
- def deploy(self):
- super().deploy()
+ def deploy(self, context: MinifiTestContext | None) -> bool:
+ super().deploy(context)
finished_str = "Started S3MockApplication"
return wait_for_condition(
condition=lambda: finished_str in self.get_logs(),
timeout_seconds=15,
bail_condition=lambda: self.exited,
- context=None)
+ context=context)
def check_s3_server_object_data(self, test_data):
(code, output) = self.exec_run(["find", "/s3mockroot/test_bucket", "-mindepth", "1", "-maxdepth", "1", "-type", "d"])
diff --git a/extensions/azure/tests/features/steps/azure_server_container.py b/extensions/azure/tests/features/steps/azure_server_container.py
index 8cdc3205b..4caeb786b 100644
--- a/extensions/azure/tests/features/steps/azure_server_container.py
+++ b/extensions/azure/tests/features/steps/azure_server_container.py
@@ -33,13 +33,13 @@ class AzureServerContainer(Container):
self.azure_connection_string = "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;" \
f"BlobEndpoint=http://{azure_storage_hostname}:10000/devstoreaccount1;QueueEndpoint=http://{azure_storage_hostname}:10001/devstoreaccount1;"
- def deploy(self):
- super().deploy()
+ def deploy(self, context: MinifiTestContext | None) -> bool:
+ super().deploy(context)
finished_str = "Azurite Queue service is successfully listening at"
return wait_for_condition(condition=lambda: finished_str in self.get_logs(),
timeout_seconds=15,
bail_condition=lambda: self.exited,
- context=None)
+ context=context)
def check_azure_storage_server_data(self, test_data):
(code, output) = self.exec_run(["find", "/data/__blobstorage__", "-type", "f"])
diff --git a/extensions/azure/tests/features/steps/steps.py b/extensions/azure/tests/features/steps/steps.py
index 3331d7e71..58ad46e46 100644
--- a/extensions/azure/tests/features/steps/steps.py
+++ b/extensions/azure/tests/features/steps/steps.py
@@ -43,7 +43,7 @@ def step_impl(context: MinifiTestContext, processor_name: str):
@step("an Azure storage server is set up")
def step_impl(context):
context.containers["azure-storage-server"] = AzureServerContainer(context)
- assert context.containers["azure-storage-server"].deploy()
+ assert context.containers["azure-storage-server"].deploy(context)
@then('the object on the Azure storage server is "{object_data}"')
diff --git a/extensions/couchbase/tests/features/steps/couchbase_server_container.py b/extensions/couchbase/tests/features/steps/couchbase_server_container.py
index 96cddf821..52228951d 100644
--- a/extensions/couchbase/tests/features/steps/couchbase_server_container.py
+++ b/extensions/couchbase/tests/features/steps/couchbase_server_container.py
@@ -37,14 +37,14 @@ class CouchbaseServerContainer(Container):
couchbase_key_content = crypto.dump_privatekey(type=crypto.FILETYPE_PEM, pkey=couchbase_key)
self.files.append(File("/opt/couchbase/var/lib/couchbase/inbox/pkey.key", couchbase_key_content, permissions=0o666))
- def deploy(self):
- super().deploy()
+ def deploy(self, context: MinifiTestContext | None) -> bool:
+ super().deploy(context)
finished_str = "logs available in"
assert wait_for_condition(
condition=lambda: finished_str in self.get_logs(),
timeout_seconds=15,
bail_condition=lambda: self.exited,
- context=None)
+ context=context)
return self.run_post_startup_commands()
def run_post_startup_commands(self):
diff --git a/extensions/couchbase/tests/features/steps/steps.py b/extensions/couchbase/tests/features/steps/steps.py
index f20cfda2e..c1d8ba73d 100644
--- a/extensions/couchbase/tests/features/steps/steps.py
+++ b/extensions/couchbase/tests/features/steps/steps.py
@@ -28,7 +28,7 @@ from couchbase_server_container import CouchbaseServerContainer
@step("a Couchbase server is started")
def step_impl(context: MinifiTestContext):
context.containers["couchbase-server"] = CouchbaseServerContainer(context)
- assert context.containers["couchbase-server"].deploy()
+ assert context.containers["couchbase-server"].deploy(context)
@step("a CouchbaseClusterService controller service is set up to communicate with the Couchbase server")
diff --git a/extensions/elasticsearch/tests/features/steps/elastic_base_container.py b/extensions/elasticsearch/tests/features/steps/elastic_base_container.py
index 515d71aeb..5db6e61dc 100644
--- a/extensions/elasticsearch/tests/features/steps/elastic_base_container.py
+++ b/extensions/elasticsearch/tests/features/steps/elastic_base_container.py
@@ -23,13 +23,13 @@ class ElasticBaseContainer(Container):
super().__init__(image, container_name, test_context.network)
self.user = None
- def deploy(self, finished_str: str):
- super().deploy()
+ def deploy(self, context: MinifiTestContext | None, finished_str: str):
+ super().deploy(context)
return wait_for_condition(
condition=lambda: finished_str in self.get_logs(),
timeout_seconds=300,
bail_condition=lambda: self.exited,
- context=None)
+ context=context)
def create_doc_elasticsearch(self, index_name: str, doc_id: str) -> bool:
(code, output) = self.exec_run(["/bin/bash", "-c",
diff --git a/extensions/elasticsearch/tests/features/steps/elasticsearch_container.py b/extensions/elasticsearch/tests/features/steps/elasticsearch_container.py
index e06458751..037711d75 100644
--- a/extensions/elasticsearch/tests/features/steps/elasticsearch_container.py
+++ b/extensions/elasticsearch/tests/features/steps/elasticsearch_container.py
@@ -53,8 +53,8 @@ class ElasticsearchContainer(ElasticBaseContainer):
self.environment.append("ELASTIC_PASSWORD=password")
- def deploy(self):
- return super().deploy('"current.health":"GREEN"')
+ def deploy(self, context: MinifiTestContext | None) -> bool:
+ return super().deploy(context, '"current.health":"GREEN"')
def elastic_generate_apikey(self):
api_url = "https://localhost:9200/_security/api_key"
diff --git a/extensions/elasticsearch/tests/features/steps/opensearch_container.py b/extensions/elasticsearch/tests/features/steps/opensearch_container.py
index 23882f530..cdf5008d5 100644
--- a/extensions/elasticsearch/tests/features/steps/opensearch_container.py
+++ b/extensions/elasticsearch/tests/features/steps/opensearch_container.py
@@ -43,8 +43,8 @@ class OpensearchContainer(ElasticBaseContainer):
features_dir = Path(__file__).resolve().parent.parent
self.host_files.append(HostFile('/usr/share/opensearch/config/opensearch.yml', os.path.join(features_dir, "resources", "opensearch.yml")))
- def deploy(self):
- return super().deploy('Hot-reloading of audit configuration is enabled')
+ def deploy(self, context: MinifiTestContext | None) -> bool:
+ return super().deploy(context, 'Hot-reloading of audit configuration is enabled')
def add_elastic_user_to_opensearch(self):
curl_cmd = [
diff --git a/extensions/elasticsearch/tests/features/steps/steps.py b/extensions/elasticsearch/tests/features/steps/steps.py
index 810c1516d..9a1fe6954 100644
--- a/extensions/elasticsearch/tests/features/steps/steps.py
+++ b/extensions/elasticsearch/tests/features/steps/steps.py
@@ -30,7 +30,7 @@ from opensearch_container import OpensearchContainer
@step('an Elasticsearch server is set up and a single document is present with "preloaded_id" in "my_index" with "value1" in "field1"')
def step_impl(context: MinifiTestContext):
context.containers["elasticsearch"] = ElasticsearchContainer(context)
- assert context.containers["elasticsearch"].deploy()
+ assert context.containers["elasticsearch"].deploy(context)
assert context.containers["elasticsearch"].create_doc_elasticsearch("my_index", "preloaded_id") or context.containers["elasticsearch"].log_app_output()
@@ -65,7 +65,7 @@ def step_impl(context):
@given('an Opensearch server is set up and a single document is present with "preloaded_id" in "my_index" with "value1" in "field1"')
def step_impl(context):
context.containers["opensearch"] = OpensearchContainer(context)
- context.containers["opensearch"].deploy()
+ context.containers["opensearch"].deploy(context)
context.containers["opensearch"].add_elastic_user_to_opensearch()
context.containers["opensearch"].create_doc_elasticsearch("my_index", "preloaded_id")
diff --git a/extensions/gcp/tests/features/steps/fake_gcs_server_container.py b/extensions/gcp/tests/features/steps/fake_gcs_server_container.py
index 132931878..a9733ba4e 100644
--- a/extensions/gcp/tests/features/steps/fake_gcs_server_container.py
+++ b/extensions/gcp/tests/features/steps/fake_gcs_server_container.py
@@ -26,14 +26,14 @@ class FakeGcsServerContainer(Container):
command=f'-scheme http -host fake-gcs-server-{test_context.scenario_id}')
self.dirs.append(Directory(path="/data/test-bucket", files={"test-file": "preloaded data\n"}))
- def deploy(self):
- super().deploy()
+ def deploy(self, context: MinifiTestContext | None) -> bool:
+ super().deploy(context)
finished_str = "server started at http"
return wait_for_condition(
condition=lambda: finished_str in self.get_logs(),
timeout_seconds=30,
bail_condition=lambda: self.exited,
- context=None)
+ context=context)
@retry_check()
def check_google_cloud_storage(self, content):
diff --git a/extensions/gcp/tests/features/steps/steps.py b/extensions/gcp/tests/features/steps/steps.py
index 639434d9d..175ff63c4 100644
--- a/extensions/gcp/tests/features/steps/steps.py
+++ b/extensions/gcp/tests/features/steps/steps.py
@@ -28,7 +28,7 @@ from fake_gcs_server_container import FakeGcsServerContainer
@step('a Google Cloud storage server is set up and a single object with contents "preloaded data" is present')
def step_impl(context: MinifiTestContext):
context.containers["fake-gcs-server"] = FakeGcsServerContainer(context)
- assert context.containers["fake-gcs-server"].deploy()
+ assert context.containers["fake-gcs-server"].deploy(context)
@then('an object with the content \"{content}\" is present in the Google Cloud storage')
diff --git a/extensions/grafana-loki/tests/features/steps/grafana_loki_container.py b/extensions/grafana-loki/tests/features/steps/grafana_loki_container.py
index 46fc84b5a..1284b95b0 100644
--- a/extensions/grafana-loki/tests/features/steps/grafana_loki_container.py
+++ b/extensions/grafana-loki/tests/features/steps/grafana_loki_container.py
@@ -126,14 +126,14 @@ analytics:
self.files.append(File("/etc/loki/local-config.yaml", grafana_loki_yml_content.encode(), permissions=0o644))
- def deploy(self):
- super().deploy()
+ def deploy(self, context: MinifiTestContext | None) -> bool:
+ super().deploy(context)
finished_str = "Loki started"
return wait_for_condition(
condition=lambda: finished_str in self.get_logs(),
timeout_seconds=120,
bail_condition=lambda: self.exited,
- context=None)
+ context=context)
@retry_check()
def are_lines_present(self, lines: str, timeout: int, ssl: bool, tenant_id: str = "") -> bool:
diff --git a/extensions/grafana-loki/tests/features/steps/reverse_proxy_container.py b/extensions/grafana-loki/tests/features/steps/reverse_proxy_container.py
index c415f6dba..409a9b9e6 100644
--- a/extensions/grafana-loki/tests/features/steps/reverse_proxy_container.py
+++ b/extensions/grafana-loki/tests/features/steps/reverse_proxy_container.py
@@ -28,11 +28,11 @@ class ReverseProxyContainer(Container):
"FORWARD_PORT=3100",
]
- def deploy(self):
- super().deploy()
+ def deploy(self, context: MinifiTestContext | None) -> bool:
+ super().deploy(context)
finished_str = "start worker process"
return wait_for_condition(
condition=lambda: finished_str in self.get_logs(),
timeout_seconds=60,
bail_condition=lambda: self.exited,
- context=None)
+ context=context)
diff --git a/extensions/kafka/tests/features/steps/kafka_server_container.py b/extensions/kafka/tests/features/steps/kafka_server_container.py
index 49c15a429..30073186f 100644
--- a/extensions/kafka/tests/features/steps/kafka_server_container.py
+++ b/extensions/kafka/tests/features/steps/kafka_server_container.py
@@ -88,14 +88,14 @@ Client {
"""
self.files.append(File("/opt/kafka/config/kafka_jaas.conf", jaas_config_file_content, permissions=0o644))
- def deploy(self):
- super().deploy()
+ def deploy(self, context: MinifiTestContext | None) -> bool:
+ super().deploy(context)
finished_str = "Kafka Server started"
return wait_for_condition(
condition=lambda: finished_str in self.get_logs(),
timeout_seconds=60,
bail_condition=lambda: self.exited,
- context=None)
+ context=context)
def create_topic(self, topic_name: str):
(code, output) = self.exec_run(["/bin/sh", "-c", f"/opt/kafka/bin/kafka-topics.sh --create --topic '{topic_name}' --bootstrap-server '{self.container_name}':9092"])
diff --git a/extensions/kafka/tests/features/steps/steps.py b/extensions/kafka/tests/features/steps/steps.py
index 474cc7bf1..0b3e2ed03 100644
--- a/extensions/kafka/tests/features/steps/steps.py
+++ b/extensions/kafka/tests/features/steps/steps.py
@@ -66,7 +66,7 @@ def step_impl(context):
def step_impl(context: MinifiTestContext):
kafka_server_container = context.containers["kafka-server"]
assert isinstance(kafka_server_container, KafkaServer)
- assert kafka_server_container.deploy()
+ assert kafka_server_container.deploy(context)
@step('the topic "{topic_name}" is initialized on the kafka broker')
diff --git a/extensions/opc/tests/features/steps/opc_ua_server_container.py b/extensions/opc/tests/features/steps/opc_ua_server_container.py
index 4973b9046..868e54202 100644
--- a/extensions/opc/tests/features/steps/opc_ua_server_container.py
+++ b/extensions/opc/tests/features/steps/opc_ua_server_container.py
@@ -23,11 +23,11 @@ class OPCUAServerContainer(Container):
def __init__(self, test_context: MinifiTestContext, command: Optional[List[str]] = None):
super().__init__("lordgamez/open62541:1.4.10", f"opcua-server-{test_context.scenario_id}", test_context.network, command=command)
- def deploy(self):
- super().deploy()
+ def deploy(self, context: MinifiTestContext | None) -> bool:
+ super().deploy(context)
finished_str = "New DiscoveryUrl added: opc.tcp://"
return wait_for_condition(
condition=lambda: finished_str in self.get_logs(),
timeout_seconds=15,
bail_condition=lambda: self.exited,
- context=None)
+ context=context)
diff --git a/extensions/splunk/tests/features/steps/splunk_container.py b/extensions/splunk/tests/features/steps/splunk_container.py
index 865407a64..4106bb63e 100644
--- a/extensions/splunk/tests/features/steps/splunk_container.py
+++ b/extensions/splunk/tests/features/steps/splunk_container.py
@@ -49,14 +49,14 @@ splunk:
self.files.append(File("/opt/splunk/etc/auth/splunk_cert.pem", splunk_cert_content.decode() + splunk_key_content.decode() + root_ca_content.decode(), permissions=0o644))
self.files.append(File("/opt/splunk/etc/auth/root_ca.pem", root_ca_content.decode(), permissions=0o644))
- def deploy(self):
- super().deploy()
+ def deploy(self, context: MinifiTestContext | None) -> bool:
+ super().deploy(context)
finished_str = "Ansible playbook complete, will begin streaming splunkd_stderr.log"
return wait_for_condition(
condition=lambda: finished_str in self.get_logs(),
timeout_seconds=300,
bail_condition=lambda: False,
- context=None)
+ context=context)
@retry_check()
def check_splunk_event(self, query: str) -> bool:
diff --git a/extensions/splunk/tests/features/steps/steps.py b/extensions/splunk/tests/features/steps/steps.py
index 16a8d66e9..5902fd2c9 100644
--- a/extensions/splunk/tests/features/steps/steps.py
+++ b/extensions/splunk/tests/features/steps/steps.py
@@ -26,7 +26,7 @@ from splunk_container import SplunkContainer
@step("a Splunk HEC is set up and running")
def step_impl(context: MinifiTestContext):
context.containers["splunk"] = SplunkContainer(context)
- assert context.containers["splunk"].deploy()
+ assert context.containers["splunk"].deploy(context)
assert context.containers["splunk"].enable_splunk_hec_indexer('splunk_hec_token') or context.containers["splunk"].log_app_output()
diff --git a/extensions/sql/tests/features/steps/postgress_server_container.py b/extensions/sql/tests/features/steps/postgress_server_container.py
index 96e0eb7eb..467eecc4b 100644
--- a/extensions/sql/tests/features/steps/postgress_server_container.py
+++ b/extensions/sql/tests/features/steps/postgress_server_container.py
@@ -20,6 +20,7 @@ from textwrap import dedent
from minifi_test_framework.containers.container import Container
from minifi_test_framework.containers.docker_image_builder import DockerImageBuilder
from minifi_test_framework.core.helpers import wait_for_condition
+from minifi_test_framework.core.minifi_test_context import MinifiTestContext
class PostgresContainer(Container):
@@ -48,14 +49,14 @@ class PostgresContainer(Container):
super(PostgresContainer, self).__init__("minifi-postgres-server:latest", f"postgres-server-{context.scenario_id}", context.network)
self.environment = ["POSTGRES_PASSWORD=password"]
- def deploy(self) -> bool:
- super(PostgresContainer, self).deploy()
+ def deploy(self, context: MinifiTestContext | None) -> bool:
+ super(PostgresContainer, self).deploy(context)
finished_str = "database system is ready to accept connections"
return wait_for_condition(
condition=lambda: finished_str in self.get_logs(),
timeout_seconds=5,
bail_condition=lambda: self.exited,
- context=None)
+ context=context)
def check_query_results(self, query: str, number_of_rows: int) -> bool:
(code, output) = self.exec_run(["psql", "-U", "postgres", "-c", query])
diff --git a/extensions/standard-processors/tests/features/steps/diag_slave_container.py b/extensions/standard-processors/tests/features/steps/diag_slave_container.py
index a168c7325..ba89e75c3 100644
--- a/extensions/standard-processors/tests/features/steps/diag_slave_container.py
+++ b/extensions/standard-processors/tests/features/steps/diag_slave_container.py
@@ -40,14 +40,14 @@ ENV PROTOCOL=tcp
super().__init__("minifi-diag-slave-tcp:latest", f"diag-slave-tcp-{test_context.scenario_id}", test_context.network)
- def deploy(self):
- super().deploy()
+ def deploy(self, context: MinifiTestContext | None) -> bool:
+ super().deploy(context)
finished_str = "Server started up successfully."
return wait_for_condition(
condition=lambda: finished_str in self.get_logs(),
timeout_seconds=5,
bail_condition=lambda: self.exited,
- context=None
+ context=context
)
def set_value_on_plc_with_modbus(self, modbus_cmd):
diff --git a/extensions/standard-processors/tests/features/steps/steps.py b/extensions/standard-processors/tests/features/steps/steps.py
index 85158cb9e..baa220e59 100644
--- a/extensions/standard-processors/tests/features/steps/steps.py
+++ b/extensions/standard-processors/tests/features/steps/steps.py
@@ -40,7 +40,7 @@ def step_impl(context: MinifiTestContext):
@step('there is an accessible PLC with modbus enabled')
def step_impl(context: MinifiTestContext):
modbus_container = context.containers["diag-slave-tcp"] = DiagSlave(context)
- assert modbus_container.deploy()
+ assert modbus_container.deploy(context)
@step('PLC register has been set with {modbus_cmd} command')
diff --git a/extensions/standard-processors/tests/features/steps/tcp_client_container.py b/extensions/standard-processors/tests/features/steps/tcp_client_container.py
index d3f02d16a..aca77dfae 100644
--- a/extensions/standard-processors/tests/features/steps/tcp_client_container.py
+++ b/extensions/standard-processors/tests/features/steps/tcp_client_container.py
@@ -29,12 +29,12 @@ class TcpClientContainer(Container):
)
super().__init__("alpine:3.17.3", f"tcp-client-{test_context.scenario_id}", test_context.network, cmd)
- def deploy(self):
- super().deploy()
+ def deploy(self, context: MinifiTestContext | None) -> bool:
+ super().deploy(context)
finished_str = "TCP client container started"
return wait_for_condition(
condition=lambda: finished_str in self.get_logs(),
timeout_seconds=5,
bail_condition=lambda: self.exited,
- context=None
+ context=context
)