@@ -57,6 +57,8 @@ func Test_Reconcile(t *testing.T) {
5757 name string
5858 gatewayAPIEnabled bool
5959 gatewayAPIControllerEnabled bool
60+ marketplaceEnabled bool
61+ olmEnabled bool
6062 existingObjects []runtime.Object
6163 // existingStatusSubresource contains the original version of objects
6264 // whose status will updated by Reconcile function.
@@ -72,8 +74,10 @@ func Test_Reconcile(t *testing.T) {
7274 expectStartCtrl bool
7375 }{
7476 {
75- name : "gateway API disabled" ,
76- gatewayAPIEnabled : false ,
77+ name : "gateway API disabled" ,
78+ gatewayAPIEnabled : false ,
79+ marketplaceEnabled : true ,
80+ olmEnabled : true ,
7781 existingObjects : []runtime.Object {
7882 co ("ingress" ),
7983 },
@@ -86,6 +90,8 @@ func Test_Reconcile(t *testing.T) {
8690 name : "gateway API enabled" ,
8791 gatewayAPIEnabled : true ,
8892 gatewayAPIControllerEnabled : true ,
93+ marketplaceEnabled : true ,
94+ olmEnabled : true ,
8995 existingObjects : []runtime.Object {
9096 co ("ingress" ),
9197 },
@@ -106,6 +112,30 @@ func Test_Reconcile(t *testing.T) {
106112 name : "gateway API enabled, gateway API controller disabled" ,
107113 gatewayAPIEnabled : true ,
108114 gatewayAPIControllerEnabled : false ,
115+ marketplaceEnabled : true ,
116+ olmEnabled : true ,
117+ existingObjects : []runtime.Object {
118+ co ("ingress" ),
119+ },
120+ expectCreate : []client.Object {
121+ crd ("gatewayclasses.gateway.networking.k8s.io" ),
122+ crd ("gateways.gateway.networking.k8s.io" ),
123+ crd ("grpcroutes.gateway.networking.k8s.io" ),
124+ crd ("httproutes.gateway.networking.k8s.io" ),
125+ crd ("referencegrants.gateway.networking.k8s.io" ),
126+ clusterRole ("system:openshift:gateway-api:aggregate-to-admin" ),
127+ clusterRole ("system:openshift:gateway-api:aggregate-to-view" ),
128+ },
129+ expectUpdate : []client.Object {},
130+ expectDelete : []client.Object {},
131+ expectStartCtrl : false ,
132+ },
133+ {
134+ name : "GatewayAPI enabled, GatewayAPIController enabled, marketplace and OLM capabilities disabled" ,
135+ gatewayAPIEnabled : true ,
136+ gatewayAPIControllerEnabled : true ,
137+ marketplaceEnabled : false ,
138+ olmEnabled : false ,
109139 existingObjects : []runtime.Object {
110140 co ("ingress" ),
111141 },
@@ -126,6 +156,8 @@ func Test_Reconcile(t *testing.T) {
126156 name : "unmanaged gateway API CRDs created" ,
127157 gatewayAPIEnabled : true ,
128158 gatewayAPIControllerEnabled : true ,
159+ marketplaceEnabled : true ,
160+ olmEnabled : true ,
129161 existingObjects : []runtime.Object {
130162 co ("ingress" ),
131163 crd ("listenersets.gateway.networking.x-k8s.io" ),
@@ -154,6 +186,8 @@ func Test_Reconcile(t *testing.T) {
154186 name : "unmanaged gateway API CRDs removed" ,
155187 gatewayAPIEnabled : true ,
156188 gatewayAPIControllerEnabled : true ,
189+ marketplaceEnabled : true ,
190+ olmEnabled : true ,
157191 existingObjects : []runtime.Object {
158192 coWithExtension ("ingress" , `{"unmanagedGatewayAPICRDNames":"listenersets.gateway.networking.x-k8s.io"}` ),
159193 },
@@ -180,6 +214,8 @@ func Test_Reconcile(t *testing.T) {
180214 name : "third party CRDs" ,
181215 gatewayAPIEnabled : true ,
182216 gatewayAPIControllerEnabled : true ,
217+ marketplaceEnabled : true ,
218+ olmEnabled : true ,
183219 existingObjects : []runtime.Object {
184220 co ("ingress" ),
185221 crd ("thirdpartycrd1.openshift.io" ),
@@ -241,9 +277,11 @@ func Test_Reconcile(t *testing.T) {
241277 client : cl ,
242278 cache : cache ,
243279 config : Config {
244- GatewayAPIEnabled : tc .gatewayAPIEnabled ,
245- GatewayAPIControllerEnabled : tc .gatewayAPIControllerEnabled ,
246- DependentControllers : []controller.Controller {ctrl },
280+ GatewayAPIEnabled : tc .gatewayAPIEnabled ,
281+ GatewayAPIControllerEnabled : tc .gatewayAPIControllerEnabled ,
282+ MarketplaceEnabled : tc .marketplaceEnabled ,
283+ OperatorLifecycleManagerEnabled : tc .olmEnabled ,
284+ DependentControllers : []controller.Controller {ctrl },
247285 },
248286 }
249287 req := reconcile.Request {
@@ -316,9 +354,11 @@ func TestReconcileOnlyStartsControllerOnce(t *testing.T) {
316354 client : cl ,
317355 cache : cache ,
318356 config : Config {
319- GatewayAPIEnabled : true ,
320- GatewayAPIControllerEnabled : true ,
321- DependentControllers : []controller.Controller {ctrl },
357+ GatewayAPIEnabled : true ,
358+ GatewayAPIControllerEnabled : true ,
359+ MarketplaceEnabled : true ,
360+ OperatorLifecycleManagerEnabled : true ,
361+ DependentControllers : []controller.Controller {ctrl },
322362 },
323363 }
324364 req := reconcile.Request {NamespacedName : types.NamespacedName {Name : "cluster" }}
0 commit comments