Skip to content

test: improve policy exception validation coverage - #105

Open
karthikmanam wants to merge 1 commit into
kyverno:mainfrom
karthikmanam:test-policyexception-validation
Open

test: improve policy exception validation coverage#105
karthikmanam wants to merge 1 commit into
kyverno:mainfrom
karthikmanam:test-policyexception-validation

Conversation

@karthikmanam

Copy link
Copy Markdown

Explanation

Improve the PolicyException validation test coverage by adding missing validation scenarios and making the GetKind subtest names more descriptive. This is a test-only change and does not modify production behavior.

Related issue

Fixes #104

Proposed Changes

  • Rename the duplicate TestCELPolicyException_GetKind subtest for clearer test output.
  • Add validation test coverage for a policy reference missing both name and kind.
  • Add validation test coverage for multiple invalid policy references with indexed field errors.
  • Remove the existing TODO by covering the previously untested cases.

Checklist

  • I have read the contributing guidelines.
  • I have read the PR documentation guide and followed the process including adding proof manifests to this PR.
  • This is a bug fix and I have added unit tests that prove my fix is effective.

Further Comments

Signed-off-by: Karthik babu Manam <karthikmanam@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves unit test coverage for PolicyException validation and clarifies subtest output, aligning with issue #104 by exercising previously untested validation branches without changing production behavior.

Changes:

  • Renamed a duplicate TestCELPolicyException_GetKind subtest to avoid ambiguous test output.
  • Added validation test cases for a policy reference missing both name and kind.
  • Added validation coverage for multiple invalid policy references, asserting indexed field paths in returned errors.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve PolicyException validation test coverage

2 participants