@@ -18,9 +18,6 @@ var _ = Describe("Recreate options", Ordered, func() {
1818 configMapYAML = "../resources/case40_recreate_option/configmap-with-finalizer.yaml"
1919 policyNoRecreateYAML = "../resources/case40_recreate_option/policy-no-recreate-options.yaml"
2020 policyAlwaysRecreateYAML = "../resources/case40_recreate_option/policy-always-recreate-option.yaml"
21-
22- podInvalidSCCYAML = "../resources/case40_recreate_option/case40_pod_invalid_scc.yaml"
23- policyPodInvalidSCCYAML = "../resources/case40_recreate_option/case40_policy_pod_invalid_scc.yaml"
2421 )
2522
2623 AfterAll (func (ctx SpecContext ) {
@@ -243,73 +240,4 @@ var _ = Describe("Recreate options", Ordered, func() {
243240
244241 deleteConfigPolicies ([]string {"case40" })
245242 })
246-
247- It ("should set dryRunNoOpOverride to true when SCC annotation is corrected by admission controllers" , func () {
248- By ("Creating a Pod that will have a valid SCC annotation assigned by OpenShift" )
249- utils .Kubectl ("apply" , "-f" , podInvalidSCCYAML )
250-
251- By ("Waiting for the Pod to have a valid SCC annotation assigned" )
252- Eventually (func () string {
253- pod := utils .GetWithTimeout (clientManagedDynamic , gvrPod ,
254- "test-pod-scc-case40" , "default" , true , defaultTimeoutSeconds )
255- sccAnnotation , exists , _ := unstructured .NestedString (
256- pod .Object , "metadata" , "annotations" , "openshift.io/scc" )
257- if ! exists {
258- return ""
259- }
260-
261- return sccAnnotation
262- }, defaultTimeoutSeconds , 1 ).ShouldNot (BeEmpty ())
263-
264- By ("Creating a policy that expects the Pod to have an invalid SCC annotation" )
265- utils .Kubectl ("apply" , "-f" , policyPodInvalidSCCYAML , "-n" , testNamespace )
266-
267- By ("Verifying the policy becomes compliant despite the SCC mismatch" )
268- Eventually (func (g Gomega ) {
269- managedPlc := utils .GetWithTimeout (clientManagedDynamic , gvrConfigPolicy ,
270- "policy-pod-invalid-scc-case40" , testNamespace , true , defaultTimeoutSeconds )
271-
272- utils .CheckComplianceStatus (g , managedPlc , "Compliant" )
273- }, defaultTimeoutSeconds , 1 ).Should (Succeed ())
274-
275- By ("Verifying dryRunNoOpOverride is true due to OpenShift SCC annotation correction" )
276- Eventually (func () bool {
277- managedPlc := utils .GetWithTimeout (clientManagedDynamic , gvrConfigPolicy ,
278- "policy-pod-invalid-scc-case40" , testNamespace , true , defaultTimeoutSeconds )
279- relatedObj := managedPlc .Object ["status" ].(map [string ]interface {})["relatedObjects" ].([]interface {})[0 ]
280- properties , exists := relatedObj .(map [string ]interface {})["properties" ]
281- if ! exists {
282- return false
283- }
284-
285- propertiesMap := properties .(map [string ]interface {})
286- if dryRunNoOpOverride , exists := propertiesMap ["dryRunNoOpOverride" ]; exists {
287- return dryRunNoOpOverride .(bool )
288- }
289-
290- return false
291- }, defaultTimeoutSeconds , 1 ).Should (BeTrue ())
292-
293- By ("Verifying createdByPolicy is true for the recreated Pod" )
294- Eventually (func () bool {
295- managedPlc := utils .GetWithTimeout (clientManagedDynamic , gvrConfigPolicy ,
296- "policy-pod-invalid-scc-case40" , testNamespace , true , defaultTimeoutSeconds )
297- relatedObj := managedPlc .Object ["status" ].(map [string ]interface {})["relatedObjects" ].([]interface {})[0 ]
298- properties , exists := relatedObj .(map [string ]interface {})["properties" ]
299- if ! exists {
300- return false
301- }
302-
303- propertiesMap := properties .(map [string ]interface {})
304- if createdByPolicy , exists := propertiesMap ["createdByPolicy" ]; exists {
305- return createdByPolicy .(bool )
306- }
307-
308- return false
309- }, defaultTimeoutSeconds , 1 ).Should (BeTrue ())
310-
311- By ("Cleaning up the test resources" )
312- utils .KubectlDelete ("configurationpolicy" , "policy-pod-invalid-scc-case40" , "-n" , testNamespace )
313- utils .KubectlDelete ("pod" , "test-pod-scc-case40" , "-n" , "default" )
314- })
315243})
0 commit comments