[test-improver] Improve tests for proxy TLS certificate generation - #10693
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds targeted coverage for TLS certificate file-write failures in the proxy package.
Changes:
- Adds table-driven tests for CA, server certificate, and private-key write failures.
- Verifies wrapped errors and nil TLS configuration results.
Show a summary per file
| File | Description |
|---|---|
internal/proxy/tls_test.go |
Tests all writePEM failure branches in GenerateSelfSignedTLS. |
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: Balanced
🔒 mcpg Read-Only Stress — default AWFSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Notes:
Overall: PASS
|
🔒 mcpg Read-Only Stress — gVisorSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Notes:
Overall: PASS References: §30962329952
|
🔒 mcpg Read-Only Stress — docker-sbxSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: PASS
References: §30962329914
|
File analyzed
internal/proxy/tls_test.go(testinginternal/proxy/tls.go)Improvements made
Added
TestGenerateSelfSignedTLS_WritePEMErrors, a table-driven test that exercises the previously-uncoveredwritePEMfailure branches insideGenerateSelfSignedTLS. It pre-creates each target file (ca.crt,server.crt,server.key) as a directory so the correspondingos.OpenFilecall inwritePEMfails with "is a directory", forcingGenerateSelfSignedTLSto return the wrapped error (failed to write CA cert/failed to write server cert/failed to write server key) and a nil*TLSConfig. Usesrequire/assertper project conventions.Coverage before/after (
internal/proxypackage)GenerateSelfSignedTLS76.5%, package total 94.6%GenerateSelfSignedTLS82.4%, package total 94.9%Test output
Also verified:
go test -count=2 ./internal/proxy/— stable, no flakesgo vet ./internal/proxy/— cleangofmt -l internal/proxy/tls_test.go— no output (already formatted)No existing tests were modified or removed.