You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When testing policies with k8s I think it would be beneficial to have some kind of admission request generator so I could test policies on my IDE (vscode) without deploying to a k8s env such as minikube.
Also, it would be helpful to get like a snapshot data json to simulate how OPA would cache information requested - e.g, if I ask OPA to cache v1/namespaces, how will the output data object will look like on a given environment on a given point in time.
If those are already available please tell me how to achieve this kind of data - it would accelerate my policy development process.
Thanks!
Awesome project!
The text was updated successfully, but these errors were encountered:
Unfortunately neither of those exist at this point in time. For the admission request generator, you could write a simple function in your test suite to generate the appropriate structure, e.g:
package tests
# obviously this is not complete, but you get the pictureadmission_review(obj) = {"request": {"object": obj}}
Then you can call this function your tests:
package example_test
import data.tests.admission_review
test_deny_foo_bar {
result := data.example.deny_foo_bar with input as admission_review(...)
}
Also, it's worth pointing out that you can specify paths in with statements:
result := data.example.deny_foo_bar with input.request.object as ...
Sometimes this makes test fixtures easier to specify.
When testing policies with k8s I think it would be beneficial to have some kind of admission request generator so I could test policies on my IDE (vscode) without deploying to a k8s env such as minikube.
Also, it would be helpful to get like a snapshot data json to simulate how OPA would cache information requested - e.g, if I ask OPA to cache v1/namespaces, how will the output data object will look like on a given environment on a given point in time.
If those are already available please tell me how to achieve this kind of data - it would accelerate my policy development process.
Thanks!
Awesome project!
The text was updated successfully, but these errors were encountered: