Skip to content

test(rewrite): bring coverage to 100% - #467

Merged
BaaRai merged 1 commit into
BaaRai:mainfrom
sresarehumantoo:test/rewrite-coverage
Nov 22, 2026
Merged

BaaRai merged 1 commit into
BaaRai:mainfrom
sresarehumantoo:test/rewrite-coverage

Conversation

@sresarehumantoo

Copy link
Copy Markdown
Contributor

Summary

  • Adds traffic/rewrite/coverage_test.go covering all previously-uncovered paths
  • Exercises the full matchers_export.go exported API (CompileMatchers, MatchHead/MatchBody, ValidateHeaderTarget, ValidToken, ParsePathQuery, BodyAllowedForStatus, SHA256Hex, Fingerprint, HasConnectionHeader, splitComma, trimOWS)
  • Covers Set.NoteError, nil-URL and nil-header branches in Apply, parseStatus edge cases ("4ab", "0xx", two-digit, four-digit), resp_headers and resp_body_regex compilation error paths

Coverage: 89.0% -> 100.0% of statements.

Test plan

  • go test ./traffic/rewrite/ passes
  • go test -coverprofile=... ./traffic/rewrite/ reports 100.0%
  • CI green

…arse edges

Adds coverage_test.go exercising the matchers_export.go wrappers
(CompileMatchers, MatchHead/MatchBody, ValidateHeaderTarget, ValidToken,
ParsePathQuery, BodyAllowedForStatus, SHA256Hex, Fingerprint,
HasConnectionHeader, splitComma/trimOWS), the Set.NoteError path, the
nil-URL and nil-header branches in Apply, parseStatus edge cases, and
the resp_headers/resp_body_regex error paths in compileMatchers.

Coverage: 89.0% -> 100.0%.
@BaaRai
BaaRai merged commit 7ef1b3f into BaaRai:main Nov 22, 2026
6 checks passed
@BaaRai

BaaRai commented Nov 22, 2026

Copy link
Copy Markdown
Owner

Thanks @sresarehumantoo. Merged. The rewrite coverage tests now exercise the edge cases we cared about, including the nil URL and header paths, the expansion limits, and the no-change cases.

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.

2 participants