@@ -62,10 +62,10 @@ tests:
6262 path : spec.policy-templates[0].objectDefinition.spec.object-templates[0].objectDefinition.metadata.namespace
6363 pattern : ^openshift-operators$
6464
65- - it : should create namespace object-template when gitOpsSubNamespace is set
65+ - it : should create namespace object-template when gitOpsSubNamespace is set to something other than openshift-operators
6666 set :
6767 global :
68- gitOpsSubNamespace : my-gitops-ns
68+ gitOpsSubNamespace : yolo
6969 clusterGroup :
7070 managedClusterGroups :
7171 region-one :
@@ -78,16 +78,16 @@ tests:
7878 path : metadata.name
7979 value : region-one-gitops-policy
8080 equal :
81- path : spec.policy-templates[0].objectDefinition.spec.object-templates[0 ].objectDefinition.kind
81+ path : spec.policy-templates[0].objectDefinition.spec.object-templates[2 ].objectDefinition.kind
8282 value : Namespace
8383 - documentSelector :
8484 path : metadata.name
8585 value : region-one-gitops-policy
8686 equal :
87- path : spec.policy-templates[0].objectDefinition.spec.object-templates[0 ].objectDefinition.metadata.name
88- value : my-gitops-ns
87+ path : spec.policy-templates[0].objectDefinition.spec.object-templates[2 ].objectDefinition.metadata.name
88+ value : yolo
8989
90- - it : should create operatorgroup object-template when gitOpsSubNamespace is set
90+ - it : should create operatorgroup object-template when gitOpsSubNamespace is set to something other than openshift-operators
9191 set :
9292 global :
9393 gitOpsSubNamespace : my-gitops-ns
@@ -103,21 +103,40 @@ tests:
103103 path : metadata.name
104104 value : region-one-gitops-policy
105105 equal :
106- path : spec.policy-templates[0].objectDefinition.spec.object-templates[1 ].objectDefinition.kind
106+ path : spec.policy-templates[0].objectDefinition.spec.object-templates[3 ].objectDefinition.kind
107107 value : OperatorGroup
108108 - documentSelector :
109109 path : metadata.name
110110 value : region-one-gitops-policy
111111 equal :
112- path : spec.policy-templates[0].objectDefinition.spec.object-templates[1 ].objectDefinition.metadata.name
112+ path : spec.policy-templates[0].objectDefinition.spec.object-templates[3 ].objectDefinition.metadata.name
113113 value : my-gitops-ns-operator-group
114114 - documentSelector :
115115 path : metadata.name
116116 value : region-one-gitops-policy
117117 equal :
118- path : spec.policy-templates[0].objectDefinition.spec.object-templates[1 ].objectDefinition.metadata.namespace
118+ path : spec.policy-templates[0].objectDefinition.spec.object-templates[3 ].objectDefinition.metadata.namespace
119119 value : my-gitops-ns
120120
121+ - it : should not create operatorgroup nor namespace object-template when gitOpsSubNamespace is set to openshift-operators
122+ set :
123+ global :
124+ gitOpsSubNamespace : openshift-operators
125+ clusterGroup :
126+ managedClusterGroups :
127+ region-one :
128+ name : region-one
129+ acmlabels :
130+ - name : clusterGroup
131+ value : region-one
132+ asserts :
133+ - documentSelector :
134+ path : metadata.name
135+ value : region-one-gitops-policy
136+ lengthEqual :
137+ path : spec.policy-templates[0].objectDefinition.spec.object-templates
138+ count : 2 # Just subscription and configmap
139+
121140 - it : should use gitOpsSubNamespace as subscription namespace when set
122141 set :
123142 global :
@@ -134,5 +153,5 @@ tests:
134153 path : metadata.name
135154 value : region-one-gitops-policy
136155 matchRegex :
137- path : spec.policy-templates[0].objectDefinition.spec.object-templates[2 ].objectDefinition.metadata.namespace
156+ path : spec.policy-templates[0].objectDefinition.spec.object-templates[3 ].objectDefinition.metadata.namespace
138157 pattern : ^my-gitops-ns$
0 commit comments