// Note: sometimes deleting namespaces takes time.
// Using different names for namespaces prevents collisions.
vartests=[]struct{
//TestDescription - Description of the Test
TestDescriptionstring
// PolicyName - Name of the Policy
PolicyNamestring
// PolicyRaw - The Yaml file of the ClusterPolicy
PolicyRaw[]byte
// ResourceName - Name of the Resource
ResourceNamestring
// ResourceNamespace - Namespace of the Resource
ResourceNamespacestring
// ResourceGVR - GVR of the Resource
ResourceGVRschema.GroupVersionResource
// ResourceRaw - The Yaml file of the ClusterPolicy
ResourceRaw[]byte
// ExpectedPatternRaw - The Yaml file that contains validate pattern for the expected result
// This is not the final result. It is just used to validate the result from the engine.
ExpectedPatternRaw[]byte
}{
{
TestDescription:"checks that runAsNonRoot is added to security context and containers elements security context",
PolicyName:"set-runasnonroot-true",
PolicyRaw:setRunAsNonRootTrue,
ResourceName:"foo",
ResourceNamespace:"test-mutate",
ResourceGVR:podGVR,
ResourceRaw:podWithContainers,
ExpectedPatternRaw:podWithContainersPattern,
},
{
TestDescription:"checks that runAsNonRoot is added to security context and containers elements security context and initContainers elements security context",