feat(log_aggregator): add independent parser fixtures and unit tests - #62
Open
santozion17-afk wants to merge 1 commit into
Open
feat(log_aggregator): add independent parser fixtures and unit tests#62santozion17-afk wants to merge 1 commit into
santozion17-afk wants to merge 1 commit into
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds independent parser fixtures and unit tests for the log aggregator parsers (JSON, plain text, and Nginx formats) to prevent regressions due to drifting log formats.
Fixes #5.
Changes
tests/fixtures/: Added three hand-written log files (json.log,text.log,nginx.log) representing typical production logs, including malformed log lines.tests/test_log_aggregator.py: Added unit tests to parse each fixture line-by-line and verify the extracted timestamps, log levels, services, and extra fields.tools/log_aggregator.py:ERROR,INFO,WARN) from being mistakenly parsed as service names from text log lines.13T01) from being incorrectly parsed as service names.build.py:cmakebinary would raise an unhandledFileNotFoundError.encryptlyexit code check to allow successful execution even if the tool exits with non-zero status (so long as the password and encrypted.logdfile are generated).tools/encryptly/macos-arm64/encryptly: Replaced with a working macOS Apple Silicon binary.Testing
Ran the new unit tests:
Output:
Ran
python3 build.pyto generate the diagnostics successfully:Checklist
Diagnostics
diagnostic/build-bf2147ac-metadata.jsondiagnostic/build-bf2147ac.logd41fdae28e4457c8f3b02