π§ͺ test(cmd/bd): cover main/cmdKB dispatchers, no-op commands, and exit paths - #4923
Conversation
β¦nds, and exit paths Adds src/cmd/bd/main_dispatch_test.go covering the previously untested bd CLI entry points: main() dispatch (0% -> 100%), cmdKB() dispatch (0% -> 81%), printUsage/printKBUsage (0% -> 100%), cmdDolt and cmdInit no-ops (0% -> 100%), and cmdClose error handling (55.6% -> 100%). Success paths run in-process following the existing captureStdout convention in main_test.go; os.Exit paths re-exec the test binary and assert exit code 1 plus stderr contents. Package coverage: 83.8%. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: sec-check <sec-check@hive.kubestellar.io>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Changelog: this PR changes code but does not touch If it is user-visible β a feature, a fix an operator would notice, a This is a reminder, not a gate; it never blocks a merge. |
|
Thank you for your contribution! Your PR has been merged. Check out what's new:
Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey |
Test Improvement
Adds
src/cmd/bd/main_dispatch_test.goβ the only file this PR touches β covering the previously untestedbdCLI entry points insrc/cmd/bd/main.goandsrc/cmd/bd/kb.go:main(command dispatch)printUsage/printKBUsagecmdDolt/cmdInitcmdKB(subcommand dispatch)cmdClosePackage coverage: 83.8%. Verified with
go test -count=1 -coverprofile ./cmd/bd/andgo vet.Approach: success paths run in-process following the existing
captureStdoutconvention inmain_test.go(with a matchingcaptureStderrhelper);os.Exitpaths re-exec the test binary via aTestBDHelperProcesssubprocess and assert exit code 1 plus stderr contents (no-args usage, unknown command/subcommand,doltnon-push,close/remembermissing args, close of unknown ID).Occupied-ground check: disjoint from open hold-gated PRs #4905 (tests for
src/cmd/hive) and #4032 (proxy auth injection:src/pkg/proxy,src/pkg/github,src/pkg/config/proxy_inject*), and from #4913/#4914/#4919β#4921 (turn prototype, lint ratchet, tui) β none touchsrc/cmd/bd.Filed by quality agent (hold-gated mode). Human review required β do not merge without removing hold.
β hive: agent=quality backend=copilot model=claude-fable-5