test(wfctl): cover plugin search output formatter#720
Merged
Conversation
Extract the wfctl plugin search table renderer into `formatPluginSearchResults` so it can be unit-tested without capturing stdout. The original inline `fmt.Printf` block had zero coverage, causing the codecov/patch gate to FAIL on workflow#715 (42.85% diff coverage vs 63.64% target) and forcing an admin-override merge. This PR closes that follow-up: - Pure helper returning a string is trivially testable. - Four tests cover: header columns, status fallback, description truncation, and field/order propagation. No behaviour change: runPluginSearch still calls fmt.Print on the same formatted output. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves test coverage for the wfctl plugin search output by extracting the table rendering logic into a helper function and adding focused unit tests, closing a patch coverage gap.
Changes:
- Extracted
wfctl plugin searchtable rendering intoformatPluginSearchResults. - Updated
runPluginSearchto print the rendered output from the new formatter helper. - Added unit tests covering header output, status fallback behavior, description truncation, and field/order propagation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| cmd/wfctl/plugin_install.go | Extracts the plugin search table renderer into formatPluginSearchResults and uses it from runPluginSearch. |
| cmd/wfctl/plugin_search_format_test.go | Adds unit tests to validate plugin search output formatting behavior. |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
⏱ Benchmark Results✅ No significant performance regressions detected. benchstat comparison (baseline → PR)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
wfctl plugin searchoutput renderer toformatPluginSearchResultshelper.Test plan
GOWORK=off go test ./cmd/wfctl/...exit 0 (60s, all tests green).GOWORK=off go vet ./cmd/wfctl/...exit 0.runPluginSearchstill prints the same table.🤖 Generated with Claude Code