CNF-25115: Include supported values in validation error messages#440
CNF-25115: Include supported values in validation error messages#440sebrandon1 wants to merge 1 commit into
Conversation
|
@sebrandon1: This pull request explicitly references no jira issue. DetailsIn response to this:
Instructions 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 openshift-eng/jira-lifecycle-plugin repository. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughValidation errors now append supported-value lists for unsupported container args, environment variables, pod labels, and resources. Tests cover expanded messages across controller, webhook, and cainjector override validation. ChangesDeployment override validation
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 15✅ Passed checks (15 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: sebrandon1 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 |
|
@sebrandon1: This pull request references CNF-25115 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set. DetailsIn response to this:
Instructions 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 openshift-eng/jira-lifecycle-plugin repository. |
6d0d9e9 to
0d543d2
Compare
0d543d2 to
7739a23
Compare
|
/retest |
7739a23 to
c58c31c
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pkg/controller/certmanager/deployment_overrides_validation_test.go`:
- Line 75: Update the relevant test cases in the deployment override validation
tests to assert the complete error message: include the
supported-environment-variable list suffix for the controller and assert the
expected empty-list formatting for webhook and cainjector. Replace the partial
“unsupported env var” expectations in each affected wantErrMsg entry while
preserving the existing validation scenarios.
- Line 194: Update the wantErrMsg assertions in the deployment validation cases
around the supported-label checks to include the expected supported-label
suffix, not just “unsupported label.” Apply the corresponding expected
supported-values text consistently to the cases at the referenced assertions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 46166aa0-9d45-43e0-989c-51b1ce9ff627
📒 Files selected for processing (1)
pkg/controller/certmanager/deployment_overrides_validation_test.go
| }, | ||
| }, | ||
| deploymentName: certmanagerControllerDeployment, | ||
| wantErrMsg: "unsupported env var", |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Assert the supported environment-variable lists.
These cases only check "unsupported env var", so removing supported env vars are: ... would not fail the tests. Assert the full supported-list suffix for controller and the empty-list behavior for webhook/cainjector.
Also applies to: 90-90, 105-105
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@pkg/controller/certmanager/deployment_overrides_validation_test.go` at line
75, Update the relevant test cases in the deployment override validation tests
to assert the complete error message: include the supported-environment-variable
list suffix for the controller and assert the expected empty-list formatting for
webhook and cainjector. Replace the partial “unsupported env var” expectations
in each affected wantErrMsg entry while preserving the existing validation
scenarios.
| }, | ||
| }, | ||
| deploymentName: certmanagerControllerDeployment, | ||
| wantErrMsg: "unsupported label", |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Assert the supported label lists.
These checks likewise validate only the generic rejection text, not the PR’s supported-values addition. Include the expected supported-label suffix for each deployment case.
Also applies to: 209-209, 224-224
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@pkg/controller/certmanager/deployment_overrides_validation_test.go` at line
194, Update the wantErrMsg assertions in the deployment validation cases around
the supported-label checks to include the expected supported-label suffix, not
just “unsupported label.” Apply the corresponding expected supported-values text
consistently to the cases at the referenced assertions.
Append the list of supported values to all five validation error messages (args, env vars, labels, resource limits, resource requests) so users can see what is allowed without checking documentation. Also fix terminology in validateEnv (was "unsupported arg", now "unsupported env var"). Add unit tests for the previously untested withContainerEnvValidateHook and withPodLabelsValidateHook hooks, and strengthen TestValidateResources to assert error messages include the supported values list.
a8b2d20 to
7a29096
Compare
|
@sebrandon1: The following test failed, say
Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
Summary
deployment_overrides_validation.goBefore
After
Test plan
go test ./pkg/controller/certmanager/...passes (all validation tests updated)make lintclean (no new issues)Summary by CodeRabbit