[test-improver] Improve tests for isDirectStdioCommand - #10510
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Expands isDirectStdioCommand unit coverage to include normalization and probe-limit edge cases.
Changes:
- Tests mixed-case runtime commands and
runarguments. - Tests probe-limit boundaries and nil arguments.
- Raises function coverage to 100%.
Show a summary per file
| File | Description |
|---|---|
internal/launcher/launcher_runtime_test.go |
Adds six table-driven edge-case tests. |
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 — defaultSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: PASS
|
🔒 mcpg Read-Only Stress — gVisorSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Notes:
Overall: PASS ✅ References: §30674813916
|
🔒 mcpg Read-Only Stress — docker-sbxSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: PASS
References: §30674813924
|
File analyzed
internal/launcher/launcher_runtime_test.go(testsisDirectStdioCommandininternal/launcher/launcher.go)Improvements made
Extended the existing table-driven
TestIsDirectStdioCommandtest with 6 new cases covering previously-untested branches:Docker,PODMAN) to exercise thestrings.ToLowernormalizationrunargument appearing beyond themaxRunProbeArgs(3) scan limit — verifies the function correctly does not detect it as containerized (this branch,limit > maxRunProbeArgs, was previously never exercised)runargument exactly at the probe-limit boundary — verifies it is detectednilargs sliceRUNargument to exercisestrings.EqualFoldNo existing tests were modified or removed; all previously passing cases still pass.
Coverage before/after
isDirectStdioCommandfunction coverage: 92.9% → 100.0% (pergo tool cover -func). The previously uncovered branch was the argument-scan truncation logic (limit := len(serverCfg.Args); if limit > maxRunProbeArgs { limit = maxRunProbeArgs }).Test output
Also verified:
go test -count=3 ./internal/launcher/passes,go vet ./internal/launcher/clean,gofmt -lclean, full package test suite (go test -count=1 ./internal/launcher/) passes in 16.8s.