Add unit tests for SyslogUtils#26488
Open
karimbabasf wants to merge 2 commits into
Open
Conversation
SyslogUtils had no test coverage. Add characterization tests for the RFC 5424 level and facility lookup tables (every documented value plus out-of-range inputs), and for the priority bit-math helpers including the two RFC 5424 worked examples and a round-trip property check over all valid PRI values. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Description
Adds unit test coverage for
SyslogUtils, which previously had no tests. This is a test-only change — no production code is modified.Motivation and Context
SyslogUtilsprovides the RFC 5424 syslog severity/facility name lookups (levelToString,facilityToString) and the priority decomposition helpers (levelFromPriority,facilityFromPriority) used by the pipeline processor's syslog functions. It had no test coverage, so a future change could silently break the RFC 5424 mappings without any test failing. These characterization tests pin the documented behavior.How Has This Been Tested?
Added
SyslogUtilsTest(JUnit 5 + AssertJ, matching the module's house style). 51 parameterized cases:0–7map to the RFC 5424 names, and out-of-range values (incl.Integer.MIN/MAX_VALUE) return"Unknown";0–23map to their names, and out-of-range values return"Unknown";34→auth/Critical, PRI165→local4/Notice);facility * 8 + level == priorityfor every valid PRI value0–191.All 51 cases pass locally.
Types of changes
Test-only change: adds coverage for existing behavior, no functional change.
Checklist