@@ -24,6 +24,8 @@ var _ = Describe("GRC: [P1][Sev1][policy-grc] Test install Operator",
24
24
const (
25
25
testNS = "grcqeoptest-ns"
26
26
policyNoGroupYAML = "../resources/policy_install_operator/operator_policy_no_group.yaml"
27
+ policyNoGroupTmplYAML = "../resources/policy_install_operator/" +
28
+ "operator_policy_no_group_templated_versions.yaml"
27
29
policyWithGroupYAML = "../resources/policy_install_operator/operator_policy_with_group.yaml"
28
30
policyAllDefaultsYAML = "../resources/policy_install_operator/operator_policy_all_defaults.yaml"
29
31
cleanupPolicyYAML = "../resources/policy_install_operator/clean-up-grcqeoptest-ns.yaml"
@@ -246,6 +248,58 @@ var _ = Describe("GRC: [P1][Sev1][policy-grc] Test install Operator",
246
248
g .Expect (opDeployment ).NotTo (BeNil ())
247
249
}, defaultTimeoutSeconds * 4 , 5 ).Should (Succeed ())
248
250
})
251
+
252
+ It ("RHACM4K-53812: Should be compliant with a templated versions array" , func () {
253
+ By ("Updating the OperatorPolicy to be inform and include the templated versions array" )
254
+ _ , err := common .OcHub ("apply" , "-f" , policyNoGroupTmplYAML , "-n" , userNamespace )
255
+ Expect (err ).ToNot (HaveOccurred ())
256
+
257
+ var opPolicy * unstructured.Unstructured
258
+
259
+ By ("Waiting for the OperatorPolicy update to be processed" )
260
+ Eventually (func (g Gomega ) {
261
+ opPolicy = utils .GetWithTimeout (
262
+ clientManagedDynamic ,
263
+ common .GvrOperatorPolicy ,
264
+ "operator-policy" + noGroupSuffix ,
265
+ clusterNamespace ,
266
+ true ,
267
+ defaultTimeoutSeconds ,
268
+ )
269
+ g .Expect (opPolicy ).NotTo (BeNil ())
270
+
271
+ observedGeneration , _ , _ := unstructured .NestedInt64 (
272
+ opPolicy .Object , "status" , "observedGeneration" ,
273
+ )
274
+ g .Expect (observedGeneration ).To (Equal (opPolicy .GetGeneration ()))
275
+ }, defaultTimeoutSeconds , 1 ).Should (Succeed ())
276
+
277
+ By ("Verifying the ClusterServiceVersionCompliant condition is true" )
278
+ found := false
279
+ conditions , _ , _ := unstructured .NestedSlice (opPolicy .Object , "status" , "conditions" )
280
+
281
+ for _ , condition := range conditions {
282
+ conditionTyped , ok := condition .(map [string ]interface {})
283
+ if ! ok {
284
+ continue
285
+ }
286
+
287
+ conditionType , ok := conditionTyped ["type" ].(string )
288
+ if ! ok || conditionType != "ClusterServiceVersionCompliant" {
289
+ continue
290
+ }
291
+
292
+ conditionStatus , ok := conditionTyped ["status" ].(string )
293
+ Expect (ok ).To (BeTrue (), "Expected the condition status to be a string" )
294
+ Expect (conditionStatus ).To (Equal ("True" ))
295
+
296
+ found = true
297
+
298
+ break
299
+ }
300
+
301
+ Expect (found ).To (BeTrue (), "Expected to find a ClusterServiceVersionCompliant condition" )
302
+ })
249
303
})
250
304
251
305
Context ("When an OperatorGroup is specified" , func () {
0 commit comments