From 17c1a4f14bfe14260ad8a9ad4027d1d0e589bc59 Mon Sep 17 00:00:00 2001 From: mkadilov Date: Fri, 1 Dec 2023 15:54:28 +0300 Subject: [PATCH] [#136] Added exclude_filter Added exclude_filter Signed-off-by: Mikhail Kadilov --- src/frostfs_testlib/hosting/docker_host.py | 5 +++++ src/frostfs_testlib/hosting/interfaces.py | 1 + 2 files changed, 6 insertions(+) diff --git a/src/frostfs_testlib/hosting/docker_host.py b/src/frostfs_testlib/hosting/docker_host.py index 0e4ea11c..17146c0b 100644 --- a/src/frostfs_testlib/hosting/docker_host.py +++ b/src/frostfs_testlib/hosting/docker_host.py @@ -235,6 +235,7 @@ class DockerHost(Host): since: Optional[datetime] = None, until: Optional[datetime] = None, unit: Optional[str] = None, + exclude_filter: Optional[str] = None, ) -> str: client = self._get_docker_client() filtered_logs = "" @@ -248,6 +249,10 @@ class DockerHost(Host): matches = re.findall(filter_regex, filtered_logs, re.IGNORECASE + re.MULTILINE) found = list(matches) + + if exclude_filter: + found = [match for match in found if match != exclude_filter] + if found: filtered_logs += f"{container_name}:\n{os.linesep.join(found)}" diff --git a/src/frostfs_testlib/hosting/interfaces.py b/src/frostfs_testlib/hosting/interfaces.py index 84b79117..9dd6f3c9 100644 --- a/src/frostfs_testlib/hosting/interfaces.py +++ b/src/frostfs_testlib/hosting/interfaces.py @@ -287,6 +287,7 @@ class Host(ABC): since: Optional[datetime] = None, until: Optional[datetime] = None, unit: Optional[str] = None, + exclude_filter: Optional[str] = None, ) -> str: """Get logs from host filtered by regex.