Skip to content

lib/test: show warnings and errors in case of mismatch #2579

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ Please refer to the [NEWS](NEWS.md) for a list of changes which have an affect o
- `intelmq.tests.lib.test_pipeline.TestAmqp.test_acknowledge`: Also skip on Python 3.11 and 3.12 besides on 3.8 when running on CI (PR#2542 by Sebastian Wagner).
- Full pytest workflow: Version-independent install of postgres client, for Ubuntu 24.04 (default on GitHub now) test environment compatibility (PR#2557 by Sebastian Wagner).
- Debian package build workflow: Use artifact upload v4 instead of v3 (PR#2565 by Sebastian Wagner).
- `intelmq.lib.test.BotTestCase`: Show the warnings and errors of a bot if the amount does not match the expected number (PR#2578 by Kamil Mankowski/Sebastian Wagner, related to #2571).

### Known issues
This is short list of the most important known issues. The full list can be retrieved from [GitHub](https://github.com/certtools/intelmq/labels/bug?page=2&q=is%3Aopen+label%3Abug).
Expand Down
4 changes: 2 additions & 2 deletions intelmq/lib/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,9 @@ def run_bot(self, iterations: int = 1, error_on_pipeline: bool = False,
self.assertLoglineEqual(-1, "Bot stopped.", "INFO")

allowed_error_count = max(allowed_error_count, self.allowed_error_count)
self.assertLessEqual(len(re.findall(' - ERROR - ', self.loglines_buffer)), allowed_error_count)
self.assertLessEqual(len(re.findall(' - ERROR - ', self.loglines_buffer)), allowed_warning_count, "\n".join(re.findall(' - ERROR - [^\n]*', self.loglines_buffer)))
allowed_warning_count = max(allowed_warning_count, self.allowed_warning_count)
self.assertLessEqual(len(re.findall(' - WARNING - ', self.loglines_buffer)), allowed_warning_count)
self.assertLessEqual(len(re.findall(' - WARNING - ', self.loglines_buffer)), allowed_warning_count, "\n".join(re.findall(' - WARNING - [^\n]*', self.loglines_buffer)))
self.assertNotRegexpMatchesLog("CRITICAL")
""" If no error happened (incl. tracebacks) we can check for formatting """
if not self.allowed_error_count:
Expand Down
Loading