Skip to content

test(parsers): add independent log parser fixtures and validation script [Fixes #5] - #87

Open
gianmarcozap wants to merge 1 commit into
weilixiong:mainfrom
gianmarcozap:fix/independent-parser-fixtures-issue-5
Open

test(parsers): add independent log parser fixtures and validation script [Fixes #5]#87
gianmarcozap wants to merge 1 commit into
weilixiong:mainfrom
gianmarcozap:fix/independent-parser-fixtures-issue-5

Conversation

@gianmarcozap

Copy link
Copy Markdown

Summary

Fixes Issue #5 — Adds independent parser fixtures for ools/log_aggregator.py that are hand-written from documented log format specifications, not generated by the parser code itself. This eliminates the 40%% false-pass rate noted in the TODO comment.

Fixture Source & Intent

All fixture files were authored by hand from:

  • JSON: Standard structured logging conventions (ELK-compatible fields like @timestamp, severity, msg)
  • Text: ISO-8601 and standard datetime formats with bracket/uppercase service patterns
  • Nginx: Combined Log Format per nginx documentation (RFC 7230 status semantics)
  • Malformed: Truncated JSON, empty lines, binary garbage, JSON arrays, partial nginx

No fixture was generated by running the parsers on sample data.

Files Added

File Description
\ ests/fixtures/json_log_fixtures.json\ 4 independent JSON log line fixtures
\ ests/fixtures/text_log_fixtures.json\ 5 independent plain text log line fixtures
\ ests/fixtures/nginx_log_fixtures.json\ 4 independent nginx access log fixtures
\ ests/fixtures/malformed_log_fixtures.json\ 6 malformed/unsupported line fixtures
\ ests/test_parser_fixtures.py\ Validation script: 82 assertions

Validation

\
$ python3 tests/test_parser_fixtures.py
=== JSON Log Parser Fixtures ===
=== Text Log Parser Fixtures ===
=== Nginx Log Parser Fixtures ===
=== Malformed / Unsupported Line Fixtures ===

RESULTS: 82 passed, 0 failed

All parser fixture validations passed!
\\

build.py Diagnostic

\�uild.py\ has a pre-existing SyntaxError (f-string backslash on line 662) that prevents generating the .logd\ artifact. This is unrelated to this PR's changes.

Acceptance Criteria Checklist

  • Independent fixtures for JSON, plain text, and nginx-style log lines
  • Focused validation script verifying timestamp, level, service/format, and key fields
  • At least one malformed/unsupported line case that does not crash parsing (6 included)
  • Existing log aggregation CLI behavior unchanged (no production code modified)
  • PR description explains fixture source/intent and validation performed

Payout address: 0xBd6B1B6118eC9D736EE1d5E476f86BCA1b3739f5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant