@@ -33,7 +33,7 @@ const (
33
33
opmImage = "opm-image"
34
34
utilImage = "util-image"
35
35
bundlePath = "bundle-path"
36
- digestImage = "bundle@sha256:54d626e08c1c802b305dad30b7e54a82f102390cc92c7d4db112048935236e9c"
36
+ digestPath = "bundle-path @sha256:54d626e08c1c802b305dad30b7e54a82f102390cc92c7d4db112048935236e9c"
37
37
runAsUser = 1001
38
38
)
39
39
@@ -50,8 +50,8 @@ func TestConfigMapUnpacker(t *testing.T) {
50
50
defaultUnpackTimeoutSeconds := int64 (defaultUnpackDuration .Seconds ())
51
51
52
52
// Custom timeout to override the default cmdline flag ActiveDeadlineSeconds value
53
- customAnnotationDuration := 2 * time .Minute
54
- customAnnotationTimeoutSeconds := int64 (customAnnotationDuration .Seconds ())
53
+ // customAnnotationDuration := 2 * time.Minute
54
+ // customAnnotationTimeoutSeconds := int64(customAnnotationDuration.Seconds())
55
55
56
56
type fields struct {
57
57
objs []runtime.Object
@@ -77,7 +77,7 @@ func TestConfigMapUnpacker(t *testing.T) {
77
77
args args
78
78
expected expected
79
79
}{
80
- {
80
+ /* {
81
81
description: "NoCatalogSource/NoConfigMap/NoJob/NotCreated/Pending",
82
82
fields: fields{},
83
83
args: args{
@@ -397,20 +397,20 @@ func TestConfigMapUnpacker(t *testing.T) {
397
397
},
398
398
},
399
399
},
400
- },
400
+ },*/
401
401
{
402
402
description : "CatalogSourcePresent/ConfigMapPresent/JobPresent/DigestImage/Unpacked" ,
403
403
fields : fields {
404
404
objs : []runtime.Object {
405
405
& batchv1.Job {
406
406
ObjectMeta : metav1.ObjectMeta {
407
- Name : pathHash ,
407
+ Name : hash ( digestPath ) ,
408
408
Namespace : "ns-a" ,
409
409
OwnerReferences : []metav1.OwnerReference {
410
410
{
411
411
APIVersion : "v1" ,
412
412
Kind : "ConfigMap" ,
413
- Name : pathHash ,
413
+ Name : hash ( digestPath ) ,
414
414
Controller : & blockOwnerDeletion ,
415
415
BlockOwnerDeletion : & blockOwnerDeletion ,
416
416
},
@@ -421,7 +421,7 @@ func TestConfigMapUnpacker(t *testing.T) {
421
421
BackoffLimit : & backoffLimit ,
422
422
Template : corev1.PodTemplateSpec {
423
423
ObjectMeta : metav1.ObjectMeta {
424
- Name : pathHash ,
424
+ Name : hash ( digestPath ) ,
425
425
},
426
426
Spec : corev1.PodSpec {
427
427
RestartPolicy : corev1 .RestartPolicyNever ,
@@ -436,11 +436,11 @@ func TestConfigMapUnpacker(t *testing.T) {
436
436
{
437
437
Name : "extract" ,
438
438
Image : opmImage ,
439
- Command : []string {"opm" , "alpha" , "bundle" , "extract" , "-m" , "/bundle/" , "-n" , "ns-a" , "-c" , pathHash , "-z" },
439
+ Command : []string {"opm" , "alpha" , "bundle" , "extract" , "-m" , "/bundle/" , "-n" , "ns-a" , "-c" , hash ( digestPath ) , "-z" },
440
440
Env : []corev1.EnvVar {
441
441
{
442
442
Name : configmap .EnvContainerImage ,
443
- Value : bundlePath ,
443
+ Value : digestPath ,
444
444
},
445
445
},
446
446
VolumeMounts : []corev1.VolumeMount {
@@ -489,7 +489,7 @@ func TestConfigMapUnpacker(t *testing.T) {
489
489
},
490
490
{
491
491
Name : "pull" ,
492
- Image : digestImage ,
492
+ Image : digestPath ,
493
493
ImagePullPolicy : "IfNotPresent" ,
494
494
Command : []string {"/util/cpb" , "/bundle" }, // Copy bundle content to its mount
495
495
VolumeMounts : []corev1.VolumeMount {
@@ -549,7 +549,7 @@ func TestConfigMapUnpacker(t *testing.T) {
549
549
},
550
550
& corev1.ConfigMap {
551
551
ObjectMeta : metav1.ObjectMeta {
552
- Name : pathHash ,
552
+ Name : hash ( digestPath ) ,
553
553
Namespace : "ns-a" ,
554
554
OwnerReferences : []metav1.OwnerReference {
555
555
{
@@ -581,7 +581,7 @@ func TestConfigMapUnpacker(t *testing.T) {
581
581
args : args {
582
582
annotationTimeout : - 1 * time .Minute ,
583
583
lookup : & operatorsv1alpha1.BundleLookup {
584
- Path : bundlePath ,
584
+ Path : digestPath ,
585
585
Replaces : "" ,
586
586
CatalogSourceRef : & corev1.ObjectReference {
587
587
Namespace : "ns-a" ,
@@ -601,14 +601,14 @@ func TestConfigMapUnpacker(t *testing.T) {
601
601
expected : expected {
602
602
res : & BundleUnpackResult {
603
603
BundleLookup : & operatorsv1alpha1.BundleLookup {
604
- Path : bundlePath ,
604
+ Path : digestPath ,
605
605
Replaces : "" ,
606
606
CatalogSourceRef : & corev1.ObjectReference {
607
607
Namespace : "ns-a" ,
608
608
Name : "src-a" ,
609
609
},
610
610
},
611
- name : pathHash ,
611
+ name : hash ( digestPath ) ,
612
612
bundle : & api.Bundle {
613
613
CsvName : "etcdoperator.v0.9.2" ,
614
614
CsvJson : csvJSON + "\n " ,
@@ -623,7 +623,7 @@ func TestConfigMapUnpacker(t *testing.T) {
623
623
configMaps : []* corev1.ConfigMap {
624
624
{
625
625
ObjectMeta : metav1.ObjectMeta {
626
- Name : pathHash ,
626
+ Name : hash ( digestPath ) ,
627
627
Namespace : "ns-a" ,
628
628
Labels : map [string ]string {install .OLMManagedLabelKey : install .OLMManagedLabelValue },
629
629
OwnerReferences : []metav1.OwnerReference {
@@ -647,13 +647,13 @@ func TestConfigMapUnpacker(t *testing.T) {
647
647
jobs : []* batchv1.Job {
648
648
{
649
649
ObjectMeta : metav1.ObjectMeta {
650
- Name : pathHash ,
650
+ Name : hash ( digestPath ) ,
651
651
Namespace : "ns-a" ,
652
652
OwnerReferences : []metav1.OwnerReference {
653
653
{
654
654
APIVersion : "v1" ,
655
655
Kind : "ConfigMap" ,
656
- Name : pathHash ,
656
+ Name : hash ( digestPath ) ,
657
657
Controller : & blockOwnerDeletion ,
658
658
BlockOwnerDeletion : & blockOwnerDeletion ,
659
659
},
@@ -664,7 +664,7 @@ func TestConfigMapUnpacker(t *testing.T) {
664
664
BackoffLimit : & backoffLimit ,
665
665
Template : corev1.PodTemplateSpec {
666
666
ObjectMeta : metav1.ObjectMeta {
667
- Name : pathHash ,
667
+ Name : hash ( digestPath ) ,
668
668
},
669
669
Spec : corev1.PodSpec {
670
670
RestartPolicy : corev1 .RestartPolicyNever ,
@@ -679,11 +679,11 @@ func TestConfigMapUnpacker(t *testing.T) {
679
679
{
680
680
Name : "extract" ,
681
681
Image : opmImage ,
682
- Command : []string {"opm" , "alpha" , "bundle" , "extract" , "-m" , "/bundle/" , "-n" , "ns-a" , "-c" , pathHash , "-z" },
682
+ Command : []string {"opm" , "alpha" , "bundle" , "extract" , "-m" , "/bundle/" , "-n" , "ns-a" , "-c" , hash ( digestPath ) , "-z" },
683
683
Env : []corev1.EnvVar {
684
684
{
685
685
Name : configmap .EnvContainerImage ,
686
- Value : bundlePath ,
686
+ Value : digestPath ,
687
687
},
688
688
},
689
689
VolumeMounts : []corev1.VolumeMount {
@@ -732,7 +732,7 @@ func TestConfigMapUnpacker(t *testing.T) {
732
732
},
733
733
{
734
734
Name : "pull" ,
735
- Image : digestImage ,
735
+ Image : digestPath ,
736
736
ImagePullPolicy : "IfNotPresent" ,
737
737
Command : []string {"/util/cpb" , "/bundle" }, // Copy bundle content to its mount
738
738
VolumeMounts : []corev1.VolumeMount {
@@ -794,13 +794,13 @@ func TestConfigMapUnpacker(t *testing.T) {
794
794
roles : []* rbacv1.Role {
795
795
{
796
796
ObjectMeta : metav1.ObjectMeta {
797
- Name : pathHash ,
797
+ Name : hash ( digestPath ) ,
798
798
Namespace : "ns-a" ,
799
799
OwnerReferences : []metav1.OwnerReference {
800
800
{
801
801
APIVersion : "v1" ,
802
802
Kind : "ConfigMap" ,
803
- Name : pathHash ,
803
+ Name : hash ( digestPath ) ,
804
804
Controller : & blockOwnerDeletion ,
805
805
BlockOwnerDeletion : & blockOwnerDeletion ,
806
806
},
@@ -818,7 +818,7 @@ func TestConfigMapUnpacker(t *testing.T) {
818
818
"configmaps" ,
819
819
},
820
820
ResourceNames : []string {
821
- pathHash ,
821
+ hash ( digestPath ) ,
822
822
},
823
823
},
824
824
},
@@ -827,13 +827,13 @@ func TestConfigMapUnpacker(t *testing.T) {
827
827
roleBindings : []* rbacv1.RoleBinding {
828
828
{
829
829
ObjectMeta : metav1.ObjectMeta {
830
- Name : pathHash ,
830
+ Name : hash ( digestPath ) ,
831
831
Namespace : "ns-a" ,
832
832
OwnerReferences : []metav1.OwnerReference {
833
833
{
834
834
APIVersion : "v1" ,
835
835
Kind : "ConfigMap" ,
836
- Name : pathHash ,
836
+ Name : hash ( digestPath ) ,
837
837
Controller : & blockOwnerDeletion ,
838
838
BlockOwnerDeletion : & blockOwnerDeletion ,
839
839
},
@@ -850,7 +850,7 @@ func TestConfigMapUnpacker(t *testing.T) {
850
850
RoleRef : rbacv1.RoleRef {
851
851
APIGroup : "rbac.authorization.k8s.io" ,
852
852
Kind : "Role" ,
853
- Name : pathHash ,
853
+ Name : hash ( digestPath ) ,
854
854
},
855
855
},
856
856
},
@@ -1507,6 +1507,7 @@ func TestConfigMapUnpacker(t *testing.T) {
1507
1507
if tt .expected .res .bundle == nil {
1508
1508
require .Nil (t , res .bundle )
1509
1509
} else {
1510
+ require .NotNil (t , res .bundle )
1510
1511
require .Equal (t , tt .expected .res .bundle .CsvJson , res .bundle .CsvJson )
1511
1512
require .Equal (t , tt .expected .res .bundle .CsvName , res .bundle .CsvName )
1512
1513
require .Equal (t , tt .expected .res .bundle .Version , res .bundle .Version )
0 commit comments