[test-improver] Improve tests for config package container runtime and gateway validation - #10202
Conversation
Cover uncovered branches in: - effectiveContainerRuntimeName: invalid MCP_GATEWAY_CONTAINER_RUNTIME env var - configuredContainerRuntimeCommand: non-empty ContainerRuntimeCommand field - validateContainerRuntimeCommandNotBlank: whitespace-only command rejection - validateGatewayPayloadSizeThreshold: both valid and invalid paths Coverage improves from 97.7% to 97.9% for the config package, with container_runtime.go reaching 100% coverage. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds focused config tests for container-runtime selection, custom runtime commands, whitespace validation, and payload thresholds.
Changes:
- Covers container runtime environment/config fallback behavior.
- Tests runtime command and gateway validation branches.
Show a summary per file
| File | Description |
|---|---|
internal/config/container_runtime_test.go |
Adds config helper unit 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: 1
- Review effort level: Medium
| // "docker" config value → effectiveContainerRuntimeName should fall back to docker | ||
| got := effectiveContainerRuntimeName("docker") | ||
| assert.Equal(t, "docker", got, "invalid env var should be ignored, not used") |
🔒 mcpg Read-Only Stress — default AWFSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Notes:
Overall: PASS References: §30316811141
|
🔒 mcpg Read-Only Stress — gVisorSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: PASS Notes:
References: §30316811119
|
🔒 mcpg Read-Only Stress — docker-sbxSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: PASS
References: §30316811107
|
Summary
Added
internal/config/container_runtime_test.goto cover previously untested branches in the config package's container runtime and gateway validation helpers.File analyzed
internal/config/container_runtime.goandinternal/config/validation_gateway.goImprovements made
Added tests for four previously uncovered branches:
effectiveContainerRuntimeName— Added test for the case whereMCP_GATEWAY_CONTAINER_RUNTIMEis set to an invalid value (neitherdockernorpodman). The function should log a warning and fall back to the config value.configuredContainerRuntimeCommand— Added test for the case wheregateway.ContainerRuntimeCommandis non-empty (a custom runtime command path/name). This branch hadcov0(completely uncovered).validateContainerRuntimeCommandNotBlank— Added tests for the whitespace-only command rejection path (tab, space, newline), which was at 66.7% coverage.validateGatewayPayloadSizeThreshold— Added tests for both the valid (positive integer) and invalid (zero, negative) paths. This standalone helper was at 66.7% coverage.Coverage before/after
effectiveContainerRuntimeNameconfiguredContainerRuntimeCommandvalidateContainerRuntimeCommandNotBlankvalidateGatewayPayloadSizeThresholdTest output
All existing tests continue to pass.
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
index.crates.ioSee Network Configuration for more information.