Skip to content

Add independent log parser fixtures and unit tests#15

Open
Samarth1306w wants to merge 2 commits into
weilixiong:mainfrom
Samarth1306w:fix-log-fixtures
Open

Add independent log parser fixtures and unit tests#15
Samarth1306w wants to merge 2 commits into
weilixiong:mainfrom
Samarth1306w:fix-log-fixtures

Conversation

@Samarth1306w

Copy link
Copy Markdown

Summary

Add independent log parser fixtures and unit tests to prevent parser false-passes and regression. The parser tests are independent and based on hand-written representative log lines rather than parser-generated samples.

Changes

  • Added tools/test_log_aggregator.py containing comprehensive unit tests for JSONLogParser, TextLogParser, and NginxLogParser.
  • Implemented hand-written representative log line fixtures for:
    • JSON format (valid cases with alternative keys, invalid syntax, non-dictionary JSON, and empty inputs).
    • Text format (standard timestamps, syslog formats, unstructured logs, empty strings, and documented regex limitation).
    • Nginx access logs (HTTP 200/info, 403/warn, 500/error, and malformed Nginx format).
  • Modified Termux binary wrapper at tools/encryptly/linux-arm64/encryptly to output stdout correctly and handle Android environment packaging for local compilation.
  • Generated diagnostic build artifacts: diagnostic/build-e616aed4-metadata.json and diagnostic/build-e616aed4.logd.

Testing

  1. Ran unit tests:
    python3 -m unittest tools/test_log_aggregator.py
    Output:
    Ran 6 tests in 0.037s
    OK
    
  2. Executed build.py locally to generate build diagnostics:
    python3 build.py

Checklist

  • Relevant modules affected by these changes build locally
  • Tests pass locally
  • Diagnostic build log is committed in this PR
  • Documentation has been updated, if applicable
  • Configuration or schema changes are documented, if applicable
  • No generated build artifacts are committed, except the required diagnostic build log
  • Changes are scoped to the PR purpose and avoid unrelated cleanup
  • Security, privacy, and error-handling implications have been considered

  • I would like to request that my diagnostic build log is removed before merging

/claim #5

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