-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from tatu-aalto/log_drain3
feat: Use Drain3 to template failure messages
- Loading branch information
Showing
9 changed files
with
193 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[MASKING] | ||
masking = [ | ||
{"regex_pattern":"((?<=[^A-Za-z0-9])|^)(([0-9a-f]{2,}:){3,}([0-9a-f]{2,}))((?=[^A-Za-z0-9])|$)", "mask_with": "ID"}, | ||
{"regex_pattern":"((?<=[^A-Za-z0-9])|^)(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})((?=[^A-Za-z0-9])|$)", "mask_with": "IP"}, | ||
{"regex_pattern":"((?<=[^A-Za-z0-9])|^)([0-9a-f]{6,} ?){3,}((?=[^A-Za-z0-9])|$)", "mask_with": "SEQ"}, | ||
{"regex_pattern":"((?<=[^A-Za-z0-9])|^)([0-9A-F]{4} ?){4,}((?=[^A-Za-z0-9])|$)", "mask_with": "SEQ"}, | ||
{"regex_pattern":"((?<=[^A-Za-z0-9])|^)(0x[a-f0-9A-F]+)((?=[^A-Za-z0-9])|$)", "mask_with": "HEX"}, | ||
{"regex_pattern":"((?<=[^A-Za-z0-9])|^)([\\-\\+]?\\d+)((?=[^A-Za-z0-9])|$)", "mask_with": "NUM"}, | ||
{"regex_pattern":"(?<=executed cmd )(\".+?\")", "mask_with": "CMD"} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,61 @@ | ||
[tool.poetry] | ||
name = "failures-analysis" | ||
version = "1.1.0" | ||
description = " failures-analysis package provides fast and reliable way to find and group similar failures in test automation." | ||
authors = ["Tatu Aalto"] | ||
license = "Apache-2.0" | ||
readme = "README.md" | ||
homepage = "https://github.com/F-Secure/failures-analysis" | ||
classifiers = [ | ||
"Development Status :: 3 - Alpha", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"License :: OSI Approved :: Apache Software License", | ||
"Operating System :: OS Independent", | ||
"Topic :: Software Development :: Testing", | ||
] | ||
packages = [ | ||
{ include = "failure_analysis", from="."} | ||
] | ||
|
||
[tool.poetry.scripts] | ||
failures-analysis = "failure_analysis.failure_analysis:main" | ||
|
||
[tool.poetry.urls] | ||
"Change log" = "https://github.com/F-Secure/failures-analysis/blob/main/CHANGELOG.md" | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.8" | ||
numpy = "^1.22.4" | ||
pandas = "^1.4.2" | ||
sklearn = "^0.0" | ||
lxml = "^4.9.0" | ||
|
||
[tool.poetry.dev-dependencies] | ||
pytest = "^7.1.2" | ||
black = "^22.3.0" | ||
isort = "^5.10.1" | ||
invoke = "^1.7.1" | ||
mypy = "^0.961" | ||
flake8 = "^4.0.1" | ||
python-semantic-release = "7.28.1" | ||
approvaltests = "^5.2.0" | ||
|
||
[build-system] | ||
requires = ["poetry-core>=1.0.0"] | ||
build-backend = "poetry.core.masonry.api" | ||
|
||
[tool.black] | ||
line-length = 120 | ||
target-version = ['py38'] | ||
|
||
[tool.semantic_release] | ||
version_toml = [ | ||
"pyproject.toml:tool.poetry.version", | ||
"failure_analysis/__init__.py:__version__" | ||
] | ||
branch = "main" | ||
build_command = "poetry build" | ||
[tool.poetry] | ||
name = "failures-analysis" | ||
version = "1.1.0" | ||
description = " failures-analysis package provides fast and reliable way to find and group similar failures in test automation." | ||
authors = ["Tatu Aalto"] | ||
license = "Apache-2.0" | ||
readme = "README.md" | ||
homepage = "https://github.com/F-Secure/failures-analysis" | ||
classifiers = [ | ||
"Development Status :: 3 - Alpha", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"License :: OSI Approved :: Apache Software License", | ||
"Operating System :: OS Independent", | ||
"Topic :: Software Development :: Testing", | ||
] | ||
packages = [ | ||
{ include = "failure_analysis", from="."} | ||
] | ||
|
||
[tool.poetry.scripts] | ||
failures-analysis = "failure_analysis.failure_analysis:main" | ||
|
||
[tool.poetry.urls] | ||
"Change log" = "https://github.com/F-Secure/failures-analysis/blob/main/CHANGELOG.md" | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.8" | ||
numpy = "^1.22.4" | ||
pandas = "^1.4.2" | ||
sklearn = "^0.0" | ||
lxml = "^4.9.0" | ||
drain3 = "^0.9.10" | ||
|
||
[tool.poetry.dev-dependencies] | ||
pytest = "^7.1.2" | ||
black = "^22.3.0" | ||
isort = "^5.10.1" | ||
invoke = "^1.7.1" | ||
mypy = "^0.961" | ||
flake8 = "^4.0.1" | ||
python-semantic-release = "7.28.1" | ||
approvaltests = "^5.2.0" | ||
|
||
[build-system] | ||
requires = ["poetry-core>=1.0.0"] | ||
build-backend = "poetry.core.masonry.api" | ||
|
||
[tool.black] | ||
line-length = 120 | ||
target-version = ['py38'] | ||
|
||
[tool.semantic_release] | ||
version_toml = [ | ||
"pyproject.toml:tool.poetry.version", | ||
"failure_analysis/__init__.py:__version__" | ||
] | ||
branch = "main" | ||
build_command = "poetry build" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[MASKING] | ||
masking = [ | ||
{"regex_pattern":"((?<=[^A-Za-z0-9])|^)(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})((?=[^A-Za-z0-9])|$)", "mask_with": "IP_ADDRESS"} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from pathlib import Path | ||
|
||
from approvaltests import verify # type: ignore | ||
|
||
from failure_analysis.failure_analysis import template_failures | ||
|
||
UTEST_ROOT = Path(__file__).resolve().parent | ||
XUNIT_FILES_DIR = UTEST_ROOT / "resources" | ||
|
||
|
||
def test_template_failures(): | ||
failures = [ | ||
"def test_02():\n> assert 'connected to 192.168.0.1' == 'connected to 192.0.0.0'\nE assert False\n\n\ntests\\test_me.py:6: AssertionError", | ||
"def test_02():\n> assert 'connected to 192.168.0.2' == 'connected to 192.0.0.0'\nE assert False\n\n\ntests\\test_me.py:6: AssertionError", | ||
"def test_02():\n> assert 'connected to 192.168.0.3' == 'connected to 192.0.0.0'\nE assert False\n\n\ntests\\test_me.py:6: AssertionError", | ||
] | ||
verify(template_failures(failures, "")) | ||
|
||
|
||
def test_custom_ini(tmp_path): | ||
failures = [ | ||
"def test_02():\n> assert 'connected to 192.168.0.1' == 'connected to 192.0.0.0'\nE assert False\n\n\ntests\\test_me.py:6: AssertionError", | ||
] | ||
drain3_ini = XUNIT_FILES_DIR / "drain3.ini" | ||
drain3_ini = drain3_ini.resolve() | ||
assert drain3_ini.is_file() | ||
verify(template_failures(failures, str(drain3_ini))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
["def test_02(): > assert 'connected to <IP_ADDRESS>' == 'connected to <IP_ADDRESS>' E assert False tests\\test_me.py:6: AssertionError"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
["def test_<NUM>(): > assert 'connected to <IP>' == 'connected to <IP>' E assert False tests\\test_me.py:<NUM>: AssertionError", "def test_<NUM>(): > assert 'connected to <IP>' == 'connected to <IP>' E assert False tests\\test_me.py:<NUM>: AssertionError", "def test_<NUM>(): > assert 'connected to <IP>' == 'connected to <IP>' E assert False tests\\test_me.py:<NUM>: AssertionError"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters