GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — test: add unit tests for resolveBuilder in cmd/ci by Ankitsinghsisodya · Pull Request #3570 · knative/func Conversation
|
| File | Change |
|---|---|
cmd/ci/config_test.go |
New — 1 table-driven test with 15 sub-cases |
TestResolveBuilder (15 sub-cases):
go local → host
go remote → pack
node local/remote → pack
typescript local/remote → pack
rust local/remote → pack
quarkus local/remote → pack
springboot local/remote → pack
python local → host
python remote → s2i
unknown runtime → error
go test ./cmd/ci/... -v -run TestResolveBuilderExpected output: all 15 sub-tests PASS, ok knative.dev/func/cmd/ci.
make test passesmake check passes
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Hi @Ankitsinghsisodya. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Adds unit tests for cmd/ci/config.go’s CIConfig accessors and the resolveBuilder helper to improve coverage without requiring viper setup, mocks, or external dependencies.
Changes:
cmd/ci/config_test.go with tests for CIConfig getter/path helpers.resolveBuilder runtime→builder selection and error behavior.💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Add tests for CIConfig accessor methods and resolveBuilder helper in cmd/ci/config.go. Covered: - FnGitHubWorkflowFilepath correctly joins fnRoot, workflow dir and filename - OutputPath uses the default dir/filename constants - Verbose, FnRuntime, FnBuilder simple getters - resolveBuilder — all supported runtimes (go, node, typescript, rust, quarkus, springboot, python) both local and remote modes, plus error for unknown runtime - All remaining bool accessors: RegistryLogin, SelfHostedRunner, RemoteBuild, WorkflowDispatch, TestStep, Force - All string accessors: Branch, WorkflowName, KubeconfigSecret, RegistryLoginUrlVar, RegistryUserVar, RegistryPassSecret, RegistryUrlVar Fixes zero-coverage on config.go:221, 226, 282, 286, 290.
There was an error while loading. Please reload this page.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@ ## main #3570 +/- ## ========================================== + Coverage 55.52% 56.28% +0.75% ========================================== Files 180 180 Lines 20465 20465 ========================================== + Hits 11363 11518 +155 + Misses 7902 7749 -153 + Partials 1200 1198 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Removed accessor tests for one-liner getters (Verbose, FnRuntime, FnBuilder, BoolAccessors, StringAccessors, OutputPath, FnGitHubWorkflowFilepath) — they test Go's struct assignment, not any real logic. Kept TestResolveBuilder (15 sub-cases) which covers the non-trivial branching in resolveBuilder() across all runtimes × local/remote.
|
/approve |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Ankitsinghsisodya, matejvasek The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Add unit tests forresolveBuilder in cmd/ci/config.go
There was an error while loading. Please reload this page.