Skip to content

Commit

Permalink
TST: Fixed regex to hold gcc version
Browse files Browse the repository at this point in the history
Fixes #2185

Signed-off-by: Sebastian Waldbauer <waldbauer@cert.at>
  • Loading branch information
waldbauer-certat committed Jul 15, 2022
1 parent 3b15e09 commit de75800
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ CHANGELOG
- Add GitHub Action to run regexploit on all Python, JSON and YAML files (PR#2059 by Sebastian Wagner).
- `intelmq.lib.test`:
- Decorator `skip_ci` also detects `dpkg-buildpackage` environments by checking the environment variable `DEB_BUILD_ARCH` (PR#2123 by Sebastian Wagner).
- Fixing regex to check the GCC version too (PR#2216 by Sebastian Waldbauer, fixes #2185)
- Also test on Python 3.10 (PR#2140 by Sebastian Wagner).
- Switch from nosetests to pytest, as the former does not support Python 3.10 (PR#2140 by Sebastian Wagner).
- CodeQL Github Actions `exponential backtracking on strings` fixed. (PR#2148 by Sebastian Waldbauer, fixes #2138)
Expand Down
9 changes: 6 additions & 3 deletions intelmq/lib/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,12 @@ def run_bot(self, iterations: int = 1, error_on_pipeline: bool = False,
self.assertIn('raw', event)

""" Test if bot log messages are correctly formatted. """
self.assertLoglineMatches(0, "{} initialized with id {} and intelmq [0-9a-z.]* and python"
r" [0-9a-z.]{{5,8}}\+? \(.+?\)( \[GCC.*?\])?"
r" as process [0-9]+\."
# regex credits for semver: https://ihateregex.io/expr/semver/
self.assertLoglineMatches(0, "{} initialized with id {} and"
r" intelmq [0-9a-z.]*"
r" and python [0-9a-z.]*"
r" \(.*?\)([0-9a-zA-Z.\ \[\]]*)"
r"as process [0-9]+\."
"".format(self.bot_name,
self.bot_id), "INFO")
self.assertRegexpMatchesLog("INFO - Bot is starting.")
Expand Down

0 comments on commit de75800

Please sign in to comment.