[test-improver] Improve tests for restroute - #13664
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The test must assert the expected debug log message to validate the intended behavior.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Adds subprocess coverage for StripQuery with debug logging enabled.
Changes:
- Re-executes the test binary with
DEBUG=*. - Verifies logger activation and query stripping.
- The output assertion must check the distinctive debug message rather than generic
PASS.
| File | Description |
|---|---|
internal/restroute/restroute_test.go |
Adds debug-logging subprocess coverage; its output assertion does not currently verify that logging occurred. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
🔒 mcpg Read-Only Stress — defaultSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE No write leaked through any surface. Two methodology gaps limit how conclusively this run can attribute blocking to the gateway itself vs. absent tooling/auth:
No destructive/irreversible operations were attempted. No artifacts created, no reactions/stars applied.
|
🔒 mcpg Read-Only Stress — gvisorSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE
|
|
@copilot fix the failing lint ci checks https://github.com/github/gh-aw-mcpg/actions/runs/35861279067/job/107181834912?pr=13664 |
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Fixed the lint CI failure in commit |

File analyzed
internal/restroute/restroute_test.go(tests forinternal/restroute/restroute.go)Improvements made
TestStripQuery_DebugLoggingEnabled, a subprocess-based test exercising thelog.Enabled()debug-logging branch insideStripQuery(theif log.Enabled() { log.Printf(...) }block), which was previously untested becauselogis a package-level*logger.Loggerwhose enabled state is computed once at package-init time from theDEBUGenv var, sot.Setenvcannot retroactively flip it.DEBUG=*-subprocess pattern already established ininternal/envutil/envutil_test.go(TestGetEnvInt_DebugLoggingEnabled) for consistency across the codebase.require/assertfrom testify throughout (existing style in the file was already testify-based; no manualt.Fatal/t.Errorneeded removal).Coverage
internal/restroute: 90.0% (unchanged in the raw statement % since the subprocess body itself isn't measured by the parent test binary's coverage profile — consistent with the existingenvutilprecedent), but the debug-log branch is now exercised and verified not to panic and to log/return correctly whenDEBUG=*is set.StripQuery: 80.0% (documented/verified debug branch; remaining gap is unreachable dead code from short-circuit coverage counting, matching theenvutilpattern for the same construct).Test output
All existing tests continue to pass (
go test -v ./internal/restroute/,go test -count=3 ./internal/restroute/),go vetis clean, andgofmt -lreports no issues.