Skip to content

Commit 22d54f3

Browse files
committed
MINIFICPP-2677 Move GCP tests to modular docker tests
1 parent 0d4a898 commit 22d54f3

File tree

18 files changed

+203
-334
lines changed

18 files changed

+203
-334
lines changed

behave_framework/src/minifi_test_framework/containers/directory.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@
1616
#
1717

1818
class Directory:
19-
def __init__(self, path):
19+
def __init__(self, path, files: dict[str, str] | None = None, mode="rw"):
2020
self.path = path
2121
self.files: dict[str, str] = {}
22-
self.mode = "rw"
22+
if files is not None:
23+
self.files = files
24+
self.mode = mode
2325

2426
def add_file(self, file_name: str, content: str):
2527
self.files[file_name] = content

behave_framework/src/minifi_test_framework/steps/flow_building_steps.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,15 @@ def step_impl(context: MinifiTestContext, property_name: str, processor_name: st
9090
processor.add_property(property_name, property_value)
9191

9292

93+
@step('the "{property_name}" property of the {controller_name} controller service is set to "{property_value}"')
94+
def step_impl(context: MinifiTestContext, property_name: str, controller_name: str, property_value: str):
95+
controller_service = context.get_or_create_default_minifi_container().flow_definition.get_controller_service(controller_name)
96+
if property_value == "(not set)":
97+
controller_service.remove_property(property_name)
98+
else:
99+
controller_service.add_property(property_name, property_value)
100+
101+
93102
@step('a Funnel with the name "{funnel_name}" is set up')
94103
def step_impl(context: MinifiTestContext, funnel_name: str):
95104
context.get_or_create_default_minifi_container().flow_definition.add_funnel(Funnel(funnel_name))

docker/RunBehaveTests.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,4 +203,5 @@ exec \
203203
"${docker_dir}/../extensions/kafka/tests/features" \
204204
"${docker_dir}/../extensions/couchbase/tests/features" \
205205
"${docker_dir}/../extensions/elasticsearch/tests/features" \
206-
"${docker_dir}/../extensions/splunk/tests/features"
206+
"${docker_dir}/../extensions/splunk/tests/features" \
207+
"${docker_dir}/../extensions/gcp/tests/features"

docker/test/integration/cluster/ContainerStore.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
from .containers.KinesisServerContainer import KinesisServerContainer
2222
from .containers.S3ServerContainer import S3ServerContainer
2323
from .containers.AzureStorageServerContainer import AzureStorageServerContainer
24-
from .containers.FakeGcsServerContainer import FakeGcsServerContainer
2524
from .containers.HttpProxyContainer import HttpProxyContainer
2625
from .containers.PostgreSQLServerContainer import PostgreSQLServerContainer
2726
from .containers.MqttBrokerContainer import MqttBrokerContainer
@@ -144,14 +143,6 @@ def acquire_container(self, context, container_name: str, engine='minifi-cpp', c
144143
network=self.network,
145144
image_store=self.image_store,
146145
command=command))
147-
elif engine == 'fake-gcs-server':
148-
return self.containers.setdefault(container_name,
149-
FakeGcsServerContainer(feature_context=feature_context,
150-
name=container_name,
151-
vols=self.vols,
152-
network=self.network,
153-
image_store=self.image_store,
154-
command=command))
155146
elif engine == 'postgresql-server':
156147
return self.containers.setdefault(container_name,
157148
PostgreSQLServerContainer(feature_context=feature_context,

docker/test/integration/cluster/DockerTestCluster.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
from .MinifiControllerExecutor import MinifiControllerExecutor
2929
from .checkers.AwsChecker import AwsChecker
3030
from .checkers.AzureChecker import AzureChecker
31-
from .checkers.GcsChecker import GcsChecker
3231
from .checkers.PostgresChecker import PostgresChecker
3332
from .checkers.PrometheusChecker import PrometheusChecker
3433
from .checkers.GrafanaLokiChecker import GrafanaLokiChecker
@@ -45,7 +44,6 @@ def __init__(self, context, feature_id):
4544
self.container_store = ContainerStore(self.container_communicator.create_docker_network(feature_id), context.image_store, context.kubernetes_proxy, feature_id=feature_id)
4645
self.aws_checker = AwsChecker(self.container_communicator)
4746
self.azure_checker = AzureChecker(self.container_communicator)
48-
self.gcs_checker = GcsChecker(self.container_communicator)
4947
self.postgres_checker = PostgresChecker(self.container_communicator)
5048
self.prometheus_checker = PrometheusChecker()
5149
self.grafana_loki_checker = GrafanaLokiChecker()
@@ -234,14 +232,6 @@ def check_azure_blob_and_snapshot_count(self, blob_and_snapshot_count, timeout_s
234232
def check_azure_blob_storage_is_empty(self, timeout_seconds):
235233
return self.azure_checker.check_azure_blob_storage_is_empty(timeout_seconds)
236234

237-
def check_google_cloud_storage(self, gcs_container_name, content):
238-
gcs_container_name = self.container_store.get_container_name_with_postfix(gcs_container_name)
239-
return self.gcs_checker.check_google_cloud_storage(gcs_container_name, content)
240-
241-
def is_gcs_bucket_empty(self, container_name):
242-
container_name = self.container_store.get_container_name_with_postfix(container_name)
243-
return self.gcs_checker.is_gcs_bucket_empty(container_name)
244-
245235
def check_query_results(self, postgresql_container_name, query, number_of_rows, timeout_seconds):
246236
postgresql_container_name = self.container_store.get_container_name_with_postfix(postgresql_container_name)
247237
return self.postgres_checker.check_query_results(postgresql_container_name, query, number_of_rows, timeout_seconds)

docker/test/integration/cluster/checkers/GcsChecker.py

Lines changed: 0 additions & 30 deletions
This file was deleted.

docker/test/integration/cluster/containers/FakeGcsServerContainer.py

Lines changed: 0 additions & 40 deletions
This file was deleted.

docker/test/integration/features/MiNiFi_integration_test_driver.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -297,12 +297,6 @@ def check_http_proxy_access(self, http_proxy_container_name, url):
297297
def check_azure_storage_server_data(self, azure_container_name, object_data):
298298
assert self.cluster.check_azure_storage_server_data(azure_container_name, object_data) or self.cluster.log_app_output()
299299

300-
def check_google_cloud_storage(self, gcs_container_name, content):
301-
assert self.cluster.check_google_cloud_storage(gcs_container_name, content) or self.cluster.log_app_output()
302-
303-
def check_empty_gcs_bucket(self, gcs_container_name):
304-
assert self.cluster.is_gcs_bucket_empty(gcs_container_name) or self.cluster.log_app_output()
305-
306300
def check_minifi_log_contents(self, line, timeout_seconds=60, count=1):
307301
self.check_container_log_contents("minifi-cpp", line, timeout_seconds, count)
308302

docker/test/integration/features/google_cloud_storage.feature

Lines changed: 0 additions & 64 deletions
This file was deleted.

docker/test/integration/features/steps/steps.py

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
from minifi.core.Funnel import Funnel
1919

2020
from minifi.controllers.SSLContextService import SSLContextService
21-
from minifi.controllers.GCPCredentialsControllerService import GCPCredentialsControllerService
2221
from minifi.controllers.ODBCService import ODBCService
2322
from minifi.controllers.KubernetesControllerService import KubernetesControllerService
2423
from minifi.controllers.JsonRecordSetWriter import JsonRecordSetWriter
@@ -525,14 +524,6 @@ def step_impl(context, protocol):
525524
context.test.acquire_container(context=context, name=client_name, engine=client_name)
526525

527526

528-
# google cloud storage setup
529-
@given("a Google Cloud storage server is set up")
530-
@given("a Google Cloud storage server is set up with some test data")
531-
@given('a Google Cloud storage server is set up and a single object with contents "preloaded data" is present')
532-
def step_impl(context):
533-
context.test.acquire_container(context=context, name="fake-gcs-server", engine="fake-gcs-server")
534-
535-
536527
def setUpSslContextServiceForProcessor(context, processor_name: str):
537528
minifi_crt_file = '/tmp/resources/minifi_client.crt'
538529
minifi_key_file = '/tmp/resources/minifi_client.key'
@@ -560,31 +551,6 @@ def step_impl(context):
560551
context.test.acquire_container(context=context, name="tcp-client", engine="tcp-client")
561552

562553

563-
@given(u'the {processor_one} processor is set up with a GCPCredentialsControllerService to communicate with the Google Cloud storage server')
564-
def step_impl(context, processor_one):
565-
gcp_controller_service = GCPCredentialsControllerService(credentials_location="Use Anonymous credentials")
566-
p1 = context.test.get_node_by_name(processor_one)
567-
p1.controller_services.append(gcp_controller_service)
568-
p1.set_property("GCP Credentials Provider Service", gcp_controller_service.name)
569-
processor = context.test.get_node_by_name(processor_one)
570-
processor.set_property("Endpoint Override URL", f"fake-gcs-server-{context.feature_id}:4443")
571-
572-
573-
@given(u'the {processor_one} and the {processor_two} processors are set up with a GCPCredentialsControllerService to communicate with the Google Cloud storage server')
574-
def step_impl(context, processor_one, processor_two):
575-
gcp_controller_service = GCPCredentialsControllerService(credentials_location="Use Anonymous credentials")
576-
p1 = context.test.get_node_by_name(processor_one)
577-
p2 = context.test.get_node_by_name(processor_two)
578-
p1.controller_services.append(gcp_controller_service)
579-
p1.set_property("GCP Credentials Provider Service", gcp_controller_service.name)
580-
p2.controller_services.append(gcp_controller_service)
581-
p2.set_property("GCP Credentials Provider Service", gcp_controller_service.name)
582-
processor_one = context.test.get_node_by_name(processor_one)
583-
processor_one.set_property("Endpoint Override URL", f"fake-gcs-server-{context.feature_id}:4443")
584-
processor_two = context.test.get_node_by_name(processor_two)
585-
processor_two.set_property("Endpoint Override URL", f"fake-gcs-server-{context.feature_id}:4443")
586-
587-
588554
# SQL
589555
@given("an ODBCService is setup up for {processor_name} with the name \"{service_name}\"")
590556
def step_impl(context, processor_name, service_name):
@@ -874,17 +840,6 @@ def step_impl(context, minifi_container_name, log_pattern, duration):
874840
context.test.check_container_log_matches_regex(minifi_container_name, log_pattern, humanfriendly.parse_timespan(duration), count=1)
875841

876842

877-
# Google Cloud Storage
878-
@then('an object with the content \"{content}\" is present in the Google Cloud storage')
879-
def step_imp(context, content):
880-
context.test.check_google_cloud_storage("fake-gcs-server", content)
881-
882-
883-
@then("the test bucket of Google Cloud Storage is empty")
884-
def step_impl(context):
885-
context.test.check_empty_gcs_bucket("fake-gcs-server")
886-
887-
888843
# Prometheus
889844
@given("a Prometheus server is set up")
890845
def step_impl(context):

0 commit comments

Comments
 (0)