Repository navigation
[test] Add tests for main.main - #16783
Conversation
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
The test leaves the CLI and shared version state altered because it restores both from the wrong value, potentially affecting subsequent tests.
1 open issue
What changed in this PR
Adds focused test coverage for the main.main entrypoint by exercising Cobra’s --version path and verifying build metadata propagation without changing production code.
Changes:
- Adds a test invoking
main()with--version. - Verifies version, commit, and build-date metadata.
- Preserves and restores process and package state during cleanup.
| File | Description |
|---|---|
| main_coverage_test.go | Adds coverage for main() through the CLI version path and validates build metadata propagation. |
Review effort: Lite (adaptive)
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
This comment has been minimized.
This comment has been minimized.
Fixed the formatting issue flagged by CI; |
🔒 mcpg Read-Only Stress — defaultSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE
No write leaked in any part of this run; label/issue-filing skipped since the result is INCONCLUSIVE, not a confirmed PASS or FAIL.
|

Function Analyzed
mainmainnoopControlLoggerhelper.Why This Function?
The complete baseline report showed only two functions below 50% coverage: the trivial empty fallback logger and the executable
mainentrypoint. The new test exercises the real startup wiring through Cobra's--versionpath without starting the gateway server, verifying that build metadata is assembled and installed before command execution.Tests Added
mainthrough the real--versioncommand pathCoverage Report
Test Execution
go test . -run '^TestMain_ExecutesVersionCommand$' -count=1— passedgo test -coverprofile=/tmp/gh-aw/agent/coverage-after.out ./...— passed; selected function at 100.0%make agent-finished— all Go unit and integration tests passed; golangci-lint was unavailable and skipped by the repository target, and Rust guard tests were blocked because Cargo could not validate the configured crates.io certificate. Offline Rust execution also confirmed theserdedependency is not cached.No production code was changed.
Warning
Firewall blocked 4 domains
The following domains were blocked by the firewall during workflow execution:
example.comnonexistent.localslow.example.comthishostdoesnotexist12345.comTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.