genpolicy: unit test cases should have provenance information
Author: burgerdevCreated Sep 17, 2025Updated Sep 17, 2026
Labelsenhancement
Which feature do you think can be improved?
The genpolicy integration tests (./src/tools/genpolicy/tests/policy/testdata/**/testcases.json).
How can it be improved?
The cases have been observed by different people, massaged and copied around to the point where it's not clear what system they were observed on, if any.
Since this was mostly my doing, I'd like to clean this mess by updating the existing testcases as follows:
- Describe the test setup used for creating the requests.
- Introduce a mechanism for adjusting the genpolicy settings per integration test dir.
- Deploy the
pod.yamls from the test dirs and record the observed requests. - Canonicalize the resulting requests with
jq --sort-keysand replace the existing ones.
Additional Information
#11354 is currently blocked on this:
- Most (all?) of the
CreateContainercases did not include animage_guest_pullstorage, or any other source for the rootfs. - The cpath adjustment we do for e2e tests does not happen for genpolicy integration tests. Instead, the paths in the requests were manipulated to match the settings default.
I hope that we can automate the process for gathering test data in a follow-up project, but that would depend on at least something like #11762.
Source: kata-containers/kata-containers