mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
25 lines
847 B
Markdown
25 lines
847 B
Markdown
<small>*[documentation](/README.md#documentation) / Testing Policies*</small>
|
|
|
|
|
|
# Testing Policies
|
|
|
|
The resources definitions for testing are located in [/test](/test) directory. Each test contains a pair of files: one is the resource definition, and the second is the kyverno policy for this definition.
|
|
|
|
## Test using kubectl
|
|
|
|
To do this you should [install kyverno to the cluster](/documentation/installation.md).
|
|
|
|
For example, to test the simplest kyverno policy for ConfigMap, create the policy and then the resource itself via kubectl:
|
|
|
|
````bash
|
|
cd test/ConfigMap
|
|
kubectl create -f policy-CM.yaml
|
|
kubectl create -f CM.yaml
|
|
````
|
|
Then compare the original resource definition in CM.yaml with the actual one:
|
|
|
|
````bash
|
|
kubectl get -f CM.yaml -o yaml
|
|
````
|
|
|
|
<small>*Read Next >> [Policy Violations](/documentation/policy-violations.md)*</small>
|