{{ message }}
[test-improver] Improve tests for proxy.New and proxy.Handler#8464
Merged
lpcox merged 1 commit intoJul 2, 2026
Merged
Conversation
- TestNew_EmptyWasmPath: covers the WasmPath == "" guard (line 90-92) - TestNew_InvalidWasmPath: covers WASM load error path + GitHubAPIURL default fallback branch (line 95-97) - TestNew_InvalidDIFCMode: covers difcParseErr != nil warning branch (lines 104-106) in New - TestHandler_ServesRequests: covers Handler() constructor by routing a /health request through the returned http.Handler Coverage improvement for internal/proxy: proxy.go:New 0.0% → 64.0% proxy.go:Handler 0.0% → 100.0% package total 92.7% → 94.9% Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds unit test coverage for previously uncovered internal/proxy/proxy.go constructor helpers (New and (*Server).Handler) in the proxy package.
Changes:
- Added unit tests for
Newerror paths (empty WASM path, invalid WASM path, invalid DIFC mode fallback behavior). - Added a unit test that exercises
(*Server).Handler()end-to-end by routing a/healthrequest through the returned handler.
Show a summary per file
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Low
This was referenced Jul 2, 2026
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
Adds unit tests for two completely uncovered functions in
internal/proxy/proxy.go.File Analyzed
internal/proxy/proxy_server_test.go(new file)Implementation:
internal/proxy/proxy.goImprovements Made
Added 4 tests covering previously untested code paths:
TestNew_EmptyWasmPathcfg.WasmPath == ""guard (lines 90-92)TestNew_InvalidWasmPathGitHubAPIURLdefault fallbackTestNew_InvalidDIFCModedifcParseErr != nilwarning branch (lines 104-106)TestHandler_ServesRequestsHandler()constructor + verifies/healthresponseTestHandler_ServesRequestsreuses the existingnewTestServerhelper fromhandler_test.go(aNoopGuard-based server), so no WASM file is needed. The test routes a real/healthrequest through the wrapped handler to confirm it responds correctly.Coverage Before / After
proxy.go:Newproxy.go:HandlerThe remaining gap in
New(36%) covers the full success path which requires loading a real WASM guard module — not feasible in unit tests.Test Output
All existing proxy tests continue to pass (
go test -count=3 ./internal/proxy/— stable across 3 runs).Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
index.crates.ioSee Network Configuration for more information.