Skip to content

fix: correct broken CLI test data for allowed-label-changes and prepend-image-registry#1439

Open
AIWithShrey wants to merge 1 commit intokyverno:mainfrom
AIWithShrey:fix/broken-cli-test-data
Open

fix: correct broken CLI test data for allowed-label-changes and prepend-image-registry#1439
AIWithShrey wants to merge 1 commit intokyverno:mainfrom
AIWithShrey:fix/broken-cli-test-data

Conversation

@AIWithShrey
Copy link

Summary

Fixes 4 broken CLI test cases exposed by the test reporting fix in kyverno/kyverno#15361:

  • allowed-label-changes: Policy uses request.oldObject in a deny rule which is unavailable in CLI mode. The deny condition cannot evaluate, so badpod01 passes. Changed expected result from fail to pass.
  • prepend-image-registry: Mutation successfully applies registry.io/ prefix to all images, but 3 test cases expected result: fail with un-mutated patched resources. Updated expected results to pass and corrected patched resource files to include the registry.io/ prefix.

These tests were silently passing due to a bug in CLI test result reporting where any legacy policy test expecting result: fail always showed as passing regardless of the actual engine result.

Verification

All 4891 tests pass with the fix applied (was 4887 pass + 4 fail):

Test Summary: 4891 tests passed and 0 tests failed

Depends on: kyverno/kyverno#15361

Two test suites had incorrect test expectations that were silently
passing due to a bug in the CLI test result reporting (kyverno/kyverno#15355).
The fix in kyverno/kyverno#15361 correctly reports these as failures.

allowed-label-changes:
- Policy uses request.oldObject in a deny rule, which is unavailable
  in CLI mode. The deny condition cannot evaluate, so badpod01 passes
  rather than fails. Changed expected result to pass.

prepend-image-registry:
- Mutation successfully applies registry.io/ prefix to all container
  images, but test expected result: fail with un-mutated patched
  resources. Updated expected results to pass and patched resource
  files to include the registry.io/ prefix.

Signed-off-by: Shreyas Mocherla <shreyas@shreyasm.com>
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.

1 participant