[#168] Added exception in log analyzer and fixed arguments order in get_filtered_logs

Added exception in log analyzer and fixed arguments order in get_filtered_logs

Signed-off-by: Mikhail Kadilov <m.kadilov@yadro.com>
This commit is contained in:
Mikhail Kadilov 2023-12-06 14:39:05 +03:00 committed by Andrey Berezin
parent 8d2b3aee0e
commit 8115d28bcd

View file

@ -35,9 +35,10 @@ class TestLogs:
os.makedirs(logs_dir) os.makedirs(logs_dir)
# Using \b here because 'oom' and 'panic' can sometimes be found in OID or CID # Using \b here because 'oom' and 'panic' can sometimes be found in OID or CID
issues_regex = r"\bpanic\b|\boom\b|too many|insufficient funds|insufficient amount of gas" issues_regex = r"\bpanic\b|\boom\b|too many|insufficient funds|insufficient amount of gas"
exclude_filter = r"too many requests"
futures = parallel( futures = parallel(
self._collect_logs_on_host, cluster.hosts, logs_dir, issues_regex, session_start_time, end_time self._collect_logs_on_host, cluster.hosts, logs_dir, issues_regex, session_start_time, end_time, exclude_filter
) )
hosts_with_problems = [ hosts_with_problems = [
@ -50,9 +51,9 @@ class TestLogs:
not hosts_with_problems not hosts_with_problems
), f"The following hosts contains contain critical errors in system logs: {', '.join(hosts_with_problems)}" ), f"The following hosts contains contain critical errors in system logs: {', '.join(hosts_with_problems)}"
def _collect_logs_on_host(self, host: Host, logs_dir: str, regex: str, since: datetime, until: datetime): def _collect_logs_on_host(self, host: Host, logs_dir: str, regex: str, since: datetime, until: datetime, exclude_filter: str):
with allure.step(f"Get logs from {host.config.address}"): with allure.step(f"Get logs from {host.config.address}"):
logs = host.get_filtered_logs(regex, since, until) logs = host.get_filtered_logs(filter_regex=regex, since=since, until=until, exclude_filter=exclude_filter)
if not logs: if not logs:
return None return None