Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ __pycache__/
/logs
packaging/msi/WixWin.wsi
docker/behavex_output
behavex_output_modular
output

.vs/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,10 @@ def directory_contains_file_with_regex(self, directory_path: str, regex_str: str
command = (f"find {safe_dir_path} -maxdepth 1 -type f -print0 | "
f"xargs -0 -r grep -l -E -- {safe_regex_str}")

exit_code, output = self.exec_run(f"sh -c \"{command}\"")
exit_code, output = self.exec_run("sh -c {}".format(shlex.quote(command)))

if exit_code != 0:
logging.warning(f"directory_contains_file_with_regex {output}")
logging.debug("While looking for regex %s in directory %s, grep returned exit code %d, output: %s", regex_str, directory_path, exit_code, output)
return exit_code == 0

def path_with_content_exists(self, path: str, content: str) -> bool:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ def step_impl(context: MinifiTestContext, num: int, directory: str, duration: st


@then('at least one file in "{directory}" content match the following regex: "{regex_str}" in less than {duration}')
@then('the content of at least one file in the "{directory}" directory matches the \'{regex_str}\' regex in less than {duration}')
def step_impl(context: MinifiTestContext, directory: str, regex_str: str, duration: str):
duration_seconds = humanfriendly.parse_timespan(duration)
assert wait_for_condition(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ def step_impl(context: MinifiTestContext, processor_name: str, relationship: str


@step("{processor_name}'s {relationship} relationship is auto-terminated")
@step("the \"{relationship}\" relationship of the {processor_name} processor is auto-terminated")
def step_impl(context: MinifiTestContext, processor_name: str, relationship: str):
context.execute_steps(f'given {processor_name}\'s {relationship} relationship is auto-terminated in the "{DEFAULT_MINIFI_CONTAINER_NAME}" flow')

Expand Down
15 changes: 1 addition & 14 deletions docker/test/integration/cluster/ContainerStore.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,17 @@
from .containers.PostgreSQLServerContainer import PostgreSQLServerContainer
from .containers.SyslogUdpClientContainer import SyslogUdpClientContainer
from .containers.SyslogTcpClientContainer import SyslogTcpClientContainer
from .containers.MinifiAsPodInKubernetesCluster import MinifiAsPodInKubernetesCluster
from .FeatureContext import FeatureContext


class ContainerStore:
def __init__(self, network, image_store, kubernetes_proxy, feature_id):
def __init__(self, network, image_store, feature_id):
self.feature_id = feature_id
self.minifi_options = MinifiOptions()
self.containers = {}
self.data_directories = {}
self.network = network
self.image_store = image_store
self.kubernetes_proxy = kubernetes_proxy
self.nifi_options = NiFiOptions()

def get_container_name_with_postfix(self, container_name: str):
Expand Down Expand Up @@ -91,17 +89,6 @@ def acquire_container(self, context, container_name: str, engine='minifi-cpp', c
network=self.network,
image_store=self.image_store,
command=command))
elif engine == 'kubernetes':
return self.containers.setdefault(container_name,
MinifiAsPodInKubernetesCluster(feature_context=feature_context,
kubernetes_proxy=self.kubernetes_proxy,
config_dir=self.data_directories["kubernetes_config_dir"],
minifi_options=self.minifi_options,
name=container_name,
vols=self.vols,
network=self.network,
image_store=self.image_store,
command=command))
elif engine == 'http-proxy':
return self.containers.setdefault(container_name,
HttpProxyContainer(feature_context=feature_context,
Expand Down
2 changes: 1 addition & 1 deletion docker/test/integration/cluster/DockerTestCluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(self, context, feature_id):
self.segfault = False
self.vols = {}
self.container_communicator = DockerCommunicator()
self.container_store = ContainerStore(self.container_communicator.create_docker_network(feature_id), context.image_store, context.kubernetes_proxy, feature_id=feature_id)
self.container_store = ContainerStore(self.container_communicator.create_docker_network(feature_id), context.image_store, feature_id=feature_id)
self.azure_checker = AzureChecker(self.container_communicator)
self.postgres_checker = PostgresChecker(self.container_communicator)
self.modbus_checker = ModbusChecker(self.container_communicator)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ def create_new_data_directories(self):
"resources_dir": "/tmp/.nifi-test-resources." + self.feature_id,
"system_certs_dir": "/tmp/.nifi-test-resources." + self.feature_id + "/system_certs_dir",
"minifi_config_dir": "/tmp/.nifi-test-minifi-config-dir." + self.feature_id,
"nifi_config_dir": "/tmp/.nifi-test-nifi-config-dir." + self.feature_id,
"kubernetes_temp_dir": "/tmp/.nifi-test-kubernetes-temp-dir." + self.feature_id,
"kubernetes_config_dir": "/tmp/.nifi-test-kubernetes-config-dir." + self.feature_id
"nifi_config_dir": "/tmp/.nifi-test-nifi-config-dir." + self.feature_id
}

[self.create_directory(directory) for directory in self.data_directories[self.feature_id].values()]
Expand Down Expand Up @@ -88,7 +86,6 @@ def get_directory_bindings(self):
vols[self.data_directories[self.feature_id]["system_certs_dir"]] = {"bind": "/usr/local/share/certs", "mode": "rw"}
vols[self.data_directories[self.feature_id]["minifi_config_dir"]] = {"bind": "/tmp/minifi_config", "mode": "rw"}
vols[self.data_directories[self.feature_id]["nifi_config_dir"]] = {"bind": "/tmp/nifi_config", "mode": "rw"}
vols[self.data_directories[self.feature_id]["kubernetes_config_dir"]] = {"bind": "/tmp/kubernetes_config", "mode": "rw"}
return vols

@staticmethod
Expand Down
161 changes: 0 additions & 161 deletions docker/test/integration/cluster/KubernetesProxy.py

This file was deleted.

This file was deleted.

16 changes: 0 additions & 16 deletions docker/test/integration/features/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
from minifi import * # noqa
from cluster.ImageStore import ImageStore # noqa
from cluster.DockerTestDirectoryBindings import DockerTestDirectoryBindings # noqa
from cluster.KubernetesProxy import KubernetesProxy # noqa


def inject_feature_id(context, step):
Expand Down Expand Up @@ -60,14 +59,11 @@ def after_scenario(context, scenario):
logging.info("Integration test teardown at {time:%H:%M:%S.%f}".format(time=datetime.datetime.now()))
context.test.cleanup()
context.directory_bindings.cleanup_io()
if context.kubernetes_proxy:
context.kubernetes_proxy.delete_pods()


def before_all(context):
context.config.setup_logging()
context.image_store = ImageStore()
context.kubernetes_proxy = None


def before_feature(context, feature):
Expand All @@ -86,15 +82,3 @@ def before_feature(context, feature):
context.directory_bindings.create_cert_files()
context.root_ca_cert = context.directory_bindings.root_ca_cert
context.root_ca_key = context.directory_bindings.root_ca_key
if "requires.kubernetes.cluster" in feature.tags:
context.kubernetes_proxy = KubernetesProxy(
context.directory_bindings.get_data_directories()["kubernetes_temp_dir"],
os.path.join(os.environ['TEST_DIRECTORY'], 'resources', 'kubernetes', 'pods-etc'))
context.kubernetes_proxy.create_config(context.directory_bindings.get_directory_bindings())
context.kubernetes_proxy.start_cluster()


def after_feature(context, feature):
if "requires.kubernetes.cluster" in feature.tags and context.kubernetes_proxy:
context.kubernetes_proxy.cleanup()
context.kubernetes_proxy = None
Loading
Loading