Skip to content

πŸ§ͺ test(cmd/bd): cover main/cmdKB dispatchers, no-op commands, and exit paths - #4923

Merged
clubanderson merged 1 commit into
v4from
quality/test-bd-cli-dispatch
Aug 28, 2026
Merged

πŸ§ͺ test(cmd/bd): cover main/cmdKB dispatchers, no-op commands, and exit paths#4923
clubanderson merged 1 commit into
v4from
quality/test-bd-cli-dispatch

Conversation

@kubestellar-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds src/cmd/bd/main_dispatch_test.go β€” the only file this PR touches β€” covering the previously untested bd CLI entry points in src/cmd/bd/main.go and src/cmd/bd/kb.go:

Function Before After
main (command dispatch) 0% 100%
printUsage / printKBUsage 0% 100%
cmdDolt / cmdInit 0% 100%
cmdKB (subcommand dispatch) 0% 81.2%
cmdClose 55.6% 100%

Package coverage: 83.8%. Verified with go test -count=1 -coverprofile ./cmd/bd/ and go vet.

Approach: success paths run in-process following the existing captureStdout convention in main_test.go (with a matching captureStderr helper); os.Exit paths re-exec the test binary via a TestBDHelperProcess subprocess and assert exit code 1 plus stderr contents (no-args usage, unknown command/subcommand, dolt non-push, close/remember missing 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 touch src/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

…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>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Aug 27, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign clubanderson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@github-actions

Copy link
Copy Markdown
Contributor

Changelog: this PR changes code but does not touch CHANGELOG.md.

If it is user-visible β€” a feature, a fix an operator would notice, a
security change, a migration, a deprecation, or anything breaking β€”
please add a line under ## Unreleased. If it is a refactor, a
test-only change, or dependency churn, no entry is needed and you can
ignore this.

This is a reminder, not a gate; it never blocks a merge.

@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

Check out what's new:

Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent/quality Approved by a Hive merger/owner for auto-merge on green CI copilot dco-signoff: yes Indicates the PR's author has signed the DCO. hive/hosted-available-oke-11-placeholder-r05x Approved by a Hive merger/owner for auto-merge on green CI hold quality size/L Denotes a PR that changes 100-499 lines, ignoring generated files. testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant