Skip to content

Commit

Permalink
Fix auto rule tester (#530)
Browse files Browse the repository at this point in the history
* Make auto rule tester work with multiple configs and fix unit tests
  • Loading branch information
ppcad authored Feb 23, 2024
1 parent d153378 commit f8e898c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

### Bugfix
* fix loading of configuration inside the `AutoRuleCorpusTester` for `logprep test integration`
* fix auto rule tester (`test unit`), which was broken after adding support for multiple configuration files and resolving paths in configuration files

## v10.0.2
### Bugfix
Expand Down
11 changes: 5 additions & 6 deletions logprep/run_logprep.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,19 +154,18 @@ def dry_run(configs: tuple[str], events: str, input_type: str, full_output: bool
dry_runner.run()


@test.command(short_help="Run the rule tests of the given configuration", name="unit")
@test.command(short_help="Run the rule tests of the given configurations", name="unit")
@click.argument("configs", nargs=-1)
def test_rules(configs: tuple[str]) -> None:
"""
Test rules against their respective test files
CONFIG is a path to configuration file (filepath or URL).
"""
config_obj = _get_configuration(configs)
config_path = Path(tempfile.gettempdir(), "auto-rule-test")
config_path.write_text(config_obj.as_yaml(), encoding="utf-8")
tester = AutoRuleTester(config_path)
tester.run()
_get_configuration(configs)
for config in configs:
tester = AutoRuleTester(config)
tester.run()


@test.command(
Expand Down

0 comments on commit f8e898c

Please sign in to comment.