Raise test coverage to 90% #34

Merged
mikluko merged 1 commit from test/coverage into main 2026-10-26 21:11:40 +00:00
Owner

Total statement coverage goes from 70.7% on the modernised main to 90.4%.

The command body moves from main into run, which returns the exit status instead of calling os.Exit through zap.Fatal. That lets tests cover -print-ca, startup failures, and serving both listeners. Exit codes are unchanged: 2 for usage, 1 for other failures.

The other new tests cover behaviour that had none: log helpers outside the middleware, request IDs and sequence numbers, HTTP handler error mapping and X-Forwarded-For, MITM with an inner handler that hijacks, CA file errors, and SOCKS reply mapping.

CI runs the tests with -race and writes total coverage to the job summary. There is no coverage threshold.

Total statement coverage goes from 70.7% on the modernised `main` to 90.4%. The command body moves from `main` into `run`, which returns the exit status instead of calling `os.Exit` through `zap.Fatal`. That lets tests cover `-print-ca`, startup failures, and serving both listeners. Exit codes are unchanged: 2 for usage, 1 for other failures. The other new tests cover behaviour that had none: log helpers outside the middleware, request IDs and sequence numbers, HTTP handler error mapping and `X-Forwarded-For`, MITM with an inner handler that hijacks, CA file errors, and SOCKS reply mapping. CI runs the tests with `-race` and writes total coverage to the job summary. There is no coverage threshold.
Raise test coverage from 70.7% to 90.4%
All checks were successful
CI / changelog (pull_request) Successful in 6s
CI / test (pull_request) Successful in 1m7s
514d893470
The command body moves from main into run, which returns the exit status,
so -print-ca, startup failures and serving are tested. New tests cover the
log helpers outside the middleware, HTTP handler error mapping and
X-Forwarded-For, MITM with a hijacking inner handler, CA file errors and
SOCKS reply mapping.

CI runs the tests with -race and reports total coverage in the job summary.
mikluko deleted branch test/coverage 2026-10-26 21:11:40 +00:00
Sign in to join this conversation.
No description provided.