Skip to content

[Bug] [CLI] Verifying multiple resources in GeneratingPolicy CLI test

Kyverno CLI Version

1.15.0

Description

I converted this policy to GeneratingPolicy, the CLI tests were broken. Why? because the current structure for CLI tests for the generate rules in ClusterPolicys expects to verify the generated object from every rule in a single result, but we don't have this rule in GeneratingPolicy when we have a GeneratingPolicy that generates multiple objects. So, we need a way to be able to specify something like generatedResources instead of just generatedResource to be able to verify that a set of resources generated in any order, instead of verifying each resource in a single result.

Steps to reproduce

  1. Copy this policy
  2. Copy these cli tests in the same directory with the policy but replace any rule: * in kyverno-test.yaml to isGeneratingPolicy: true
  3. run kyvero test .kyverno-test

Expected behavior

The CLI verifies that this "set of resources" is generated.

Screenshots

Image

Kyverno logs

Slack discussion

No response

Troubleshooting

  • I have read and followed the troubleshooting guide.
  • I have searched other issues in this repository and mine is not recorded.