@@ -244,138 +244,6 @@ func getBaseCsvAndService() (v1alpha1.ClusterServiceVersion, corev1.Service) {
244
244
return baseCSV , svc
245
245
}
246
246
247
- func TestRegistryV1SuiteGenerateAllNamespace (t * testing.T ) {
248
- t .Log ("RegistryV1 Suite Convert" )
249
- t .Log ("It should generate objects successfully based on target namespaces" )
250
-
251
- t .Log ("It should convert into plain manifests successfully with AllNamespaces" )
252
- baseCSV , svc := getBaseCsvAndService ()
253
- csv := baseCSV .DeepCopy ()
254
- csv .Spec .InstallModes = []v1alpha1.InstallMode {{Type : v1alpha1 .InstallModeTypeAllNamespaces , Supported : true }}
255
-
256
- t .Log ("By creating a registry v1 bundle" )
257
- watchNamespaces := []string {"" }
258
- unstructuredSvc := convertToUnstructured (t , svc )
259
- registryv1Bundle := render.RegistryV1 {
260
- PackageName : "testPkg" ,
261
- CSV : * csv ,
262
- Others : []unstructured.Unstructured {unstructuredSvc },
263
- }
264
-
265
- t .Log ("By converting to plain" )
266
- plainBundle , err := convert .PlainConverter .Convert (registryv1Bundle , installNamespace , watchNamespaces )
267
- require .NoError (t , err )
268
-
269
- t .Log ("By verifying if plain bundle has required objects" )
270
- require .NotNil (t , plainBundle )
271
- require .Len (t , plainBundle .Objects , 5 )
272
-
273
- t .Log ("By verifying olm.targetNamespaces annotation in the deployment's pod template" )
274
- dep := findObjectByName ("test-deployment" , plainBundle .Objects )
275
- require .NotNil (t , dep )
276
- require .Contains (t , dep .(* appsv1.Deployment ).Spec .Template .Annotations , olmNamespaces )
277
- require .Equal (t , strings .Join (watchNamespaces , "," ), dep .(* appsv1.Deployment ).Spec .Template .Annotations [olmNamespaces ])
278
- }
279
-
280
- func TestRegistryV1SuiteGenerateMultiNamespace (t * testing.T ) {
281
- t .Log ("RegistryV1 Suite Convert" )
282
- t .Log ("It should generate objects successfully based on target namespaces" )
283
-
284
- t .Log ("It should convert into plain manifests successfully with MultiNamespace" )
285
- baseCSV , svc := getBaseCsvAndService ()
286
- csv := baseCSV .DeepCopy ()
287
- csv .Spec .InstallModes = []v1alpha1.InstallMode {{Type : v1alpha1 .InstallModeTypeMultiNamespace , Supported : true }}
288
-
289
- t .Log ("By creating a registry v1 bundle" )
290
- watchNamespaces := []string {"testWatchNs1" , "testWatchNs2" }
291
- unstructuredSvc := convertToUnstructured (t , svc )
292
- registryv1Bundle := render.RegistryV1 {
293
- PackageName : "testPkg" ,
294
- CSV : * csv ,
295
- Others : []unstructured.Unstructured {unstructuredSvc },
296
- }
297
-
298
- t .Log ("By converting to plain" )
299
- plainBundle , err := convert .PlainConverter .Convert (registryv1Bundle , installNamespace , watchNamespaces )
300
- require .NoError (t , err )
301
-
302
- t .Log ("By verifying if plain bundle has required objects" )
303
- require .NotNil (t , plainBundle )
304
- require .Len (t , plainBundle .Objects , 7 )
305
-
306
- t .Log ("By verifying olm.targetNamespaces annotation in the deployment's pod template" )
307
- dep := findObjectByName ("test-deployment" , plainBundle .Objects )
308
- require .NotNil (t , dep )
309
- require .Contains (t , dep .(* appsv1.Deployment ).Spec .Template .Annotations , olmNamespaces )
310
- require .Equal (t , strings .Join (watchNamespaces , "," ), dep .(* appsv1.Deployment ).Spec .Template .Annotations [olmNamespaces ])
311
- }
312
-
313
- func TestRegistryV1SuiteGenerateSingleNamespace (t * testing.T ) {
314
- t .Log ("RegistryV1 Suite Convert" )
315
- t .Log ("It should generate objects successfully based on target namespaces" )
316
-
317
- t .Log ("It should convert into plain manifests successfully with SingleNamespace" )
318
- baseCSV , svc := getBaseCsvAndService ()
319
- csv := baseCSV .DeepCopy ()
320
- csv .Spec .InstallModes = []v1alpha1.InstallMode {{Type : v1alpha1 .InstallModeTypeSingleNamespace , Supported : true }}
321
-
322
- t .Log ("By creating a registry v1 bundle" )
323
- watchNamespaces := []string {"testWatchNs1" }
324
- unstructuredSvc := convertToUnstructured (t , svc )
325
- registryv1Bundle := render.RegistryV1 {
326
- PackageName : "testPkg" ,
327
- CSV : * csv ,
328
- Others : []unstructured.Unstructured {unstructuredSvc },
329
- }
330
-
331
- t .Log ("By converting to plain" )
332
- plainBundle , err := convert .PlainConverter .Convert (registryv1Bundle , installNamespace , watchNamespaces )
333
- require .NoError (t , err )
334
-
335
- t .Log ("By verifying if plain bundle has required objects" )
336
- require .NotNil (t , plainBundle )
337
- require .Len (t , plainBundle .Objects , 5 )
338
-
339
- t .Log ("By verifying olm.targetNamespaces annotation in the deployment's pod template" )
340
- dep := findObjectByName ("test-deployment" , plainBundle .Objects )
341
- require .NotNil (t , dep )
342
- require .Contains (t , dep .(* appsv1.Deployment ).Spec .Template .Annotations , olmNamespaces )
343
- require .Equal (t , strings .Join (watchNamespaces , "," ), dep .(* appsv1.Deployment ).Spec .Template .Annotations [olmNamespaces ])
344
- }
345
-
346
- func TestRegistryV1SuiteGenerateOwnNamespace (t * testing.T ) {
347
- t .Log ("RegistryV1 Suite Convert" )
348
- t .Log ("It should generate objects successfully based on target namespaces" )
349
-
350
- t .Log ("It should convert into plain manifests successfully with own namespace" )
351
- baseCSV , svc := getBaseCsvAndService ()
352
- csv := baseCSV .DeepCopy ()
353
- csv .Spec .InstallModes = []v1alpha1.InstallMode {{Type : v1alpha1 .InstallModeTypeOwnNamespace , Supported : true }}
354
-
355
- t .Log ("By creating a registry v1 bundle" )
356
- watchNamespaces := []string {installNamespace }
357
- unstructuredSvc := convertToUnstructured (t , svc )
358
- registryv1Bundle := render.RegistryV1 {
359
- PackageName : "testPkg" ,
360
- CSV : * csv ,
361
- Others : []unstructured.Unstructured {unstructuredSvc },
362
- }
363
-
364
- t .Log ("By converting to plain" )
365
- plainBundle , err := convert .PlainConverter .Convert (registryv1Bundle , installNamespace , watchNamespaces )
366
- require .NoError (t , err )
367
-
368
- t .Log ("By verifying if plain bundle has required objects" )
369
- require .NotNil (t , plainBundle )
370
- require .Len (t , plainBundle .Objects , 5 )
371
-
372
- t .Log ("By verifying olm.targetNamespaces annotation in the deployment's pod template" )
373
- dep := findObjectByName ("test-deployment" , plainBundle .Objects )
374
- require .NotNil (t , dep )
375
- require .Contains (t , dep .(* appsv1.Deployment ).Spec .Template .Annotations , olmNamespaces )
376
- require .Equal (t , strings .Join (watchNamespaces , "," ), dep .(* appsv1.Deployment ).Spec .Template .Annotations [olmNamespaces ])
377
- }
378
-
379
247
func TestConvertInstallModeValidation (t * testing.T ) {
380
248
for _ , tc := range []struct {
381
249
description string
@@ -609,7 +477,7 @@ func TestRegistryV1SuiteGenerateWebhooks_WebhookSupportFGEnabled(t *testing.T) {
609
477
require .NotNil (t , plainBundle )
610
478
}
611
479
612
- func TestRegistryV1SuiteGenerateNoAPISerciceDefinitions (t * testing.T ) {
480
+ func TestRegistryV1SuiteGenerateNoAPIServiceDefinitions (t * testing.T ) {
613
481
t .Log ("RegistryV1 Suite Convert" )
614
482
t .Log ("It should generate objects successfully based on target namespaces" )
615
483
0 commit comments