9
9
"github.com/argoproj-labs/argocd-image-updater/pkg/common"
10
10
"github.com/argoproj-labs/argocd-image-updater/pkg/kube"
11
11
12
+ registryCommon "github.com/argoproj-labs/argocd-image-updater/registry-scanner/pkg/common"
12
13
"github.com/argoproj-labs/argocd-image-updater/registry-scanner/pkg/image"
13
14
registryKube "github.com/argoproj-labs/argocd-image-updater/registry-scanner/pkg/kube"
14
15
@@ -66,8 +67,8 @@ func Test_GetImagesFromApplication(t *testing.T) {
66
67
Name : "test-app" ,
67
68
Namespace : "argocd" ,
68
69
Annotations : map [string ]string {
69
- fmt .Sprintf (common .ForceUpdateOptionAnnotation , "nginx" ): "true" ,
70
- common .ImageUpdaterAnnotation : "nginx=nginx" ,
70
+ fmt .Sprintf (registryCommon . Prefixed ( common .ImageUpdaterAnnotationPrefix , registryCommon . ForceUpdateOptionAnnotationSuffix ) , "nginx" ): "true" ,
71
+ common .ImageUpdaterAnnotation : "nginx=nginx" ,
71
72
},
72
73
},
73
74
Spec : v1alpha1.ApplicationSpec {},
@@ -558,8 +559,8 @@ func Test_FilterApplicationsForUpdate(t *testing.T) {
558
559
func Test_GetHelmParamAnnotations (t * testing.T ) {
559
560
t .Run ("Get parameter names without symbolic names" , func (t * testing.T ) {
560
561
annotations := map [string ]string {
561
- fmt .Sprintf (common .HelmParamImageSpecAnnotation , "myimg" ): "image.blub" ,
562
- fmt .Sprintf (common .HelmParamImageTagAnnotation , "myimg" ): "image.blab" ,
562
+ fmt .Sprintf (registryCommon . Prefixed ( common .ImageUpdaterAnnotationPrefix , registryCommon . HelmParamImageSpecAnnotationSuffix ) , "myimg" ): "image.blub" ,
563
+ fmt .Sprintf (registryCommon . Prefixed ( common .ImageUpdaterAnnotationPrefix , registryCommon . HelmParamImageTagAnnotationSuffix ) , "myimg" ): "image.blab" ,
563
564
}
564
565
name , tag := getHelmParamNamesFromAnnotation (annotations , & image.ContainerImage {
565
566
ImageAlias : "" ,
@@ -570,8 +571,8 @@ func Test_GetHelmParamAnnotations(t *testing.T) {
570
571
571
572
t .Run ("Find existing image spec annotation" , func (t * testing.T ) {
572
573
annotations := map [string ]string {
573
- fmt .Sprintf (common .HelmParamImageSpecAnnotation , "myimg" ): "image.path" ,
574
- fmt .Sprintf (common .HelmParamImageTagAnnotation , "myimg" ): "image.tag" ,
574
+ fmt .Sprintf (registryCommon . Prefixed ( common .ImageUpdaterAnnotationPrefix , registryCommon . HelmParamImageSpecAnnotationSuffix ) , "myimg" ): "image.path" ,
575
+ fmt .Sprintf (registryCommon . Prefixed ( common .ImageUpdaterAnnotationPrefix , registryCommon . HelmParamImageTagAnnotationSuffix ) , "myimg" ): "image.tag" ,
575
576
}
576
577
name , tag := getHelmParamNamesFromAnnotation (annotations , & image.ContainerImage {
577
578
ImageAlias : "myimg" ,
@@ -582,8 +583,8 @@ func Test_GetHelmParamAnnotations(t *testing.T) {
582
583
583
584
t .Run ("Find existing image name and image tag annotations" , func (t * testing.T ) {
584
585
annotations := map [string ]string {
585
- fmt .Sprintf (common .HelmParamImageNameAnnotation , "myimg" ): "image.name" ,
586
- fmt .Sprintf (common .HelmParamImageTagAnnotation , "myimg" ): "image.tag" ,
586
+ fmt .Sprintf (registryCommon . Prefixed ( common .ImageUpdaterAnnotationPrefix , registryCommon . HelmParamImageNameAnnotationSuffix ) , "myimg" ): "image.name" ,
587
+ fmt .Sprintf (registryCommon . Prefixed ( common .ImageUpdaterAnnotationPrefix , registryCommon . HelmParamImageTagAnnotationSuffix ) , "myimg" ): "image.tag" ,
587
588
}
588
589
name , tag := getHelmParamNamesFromAnnotation (annotations , & image.ContainerImage {
589
590
ImageAlias : "myimg" ,
@@ -594,8 +595,8 @@ func Test_GetHelmParamAnnotations(t *testing.T) {
594
595
595
596
t .Run ("Find non-existing image name and image tag annotations" , func (t * testing.T ) {
596
597
annotations := map [string ]string {
597
- fmt .Sprintf (common .HelmParamImageNameAnnotation , "otherimg" ): "image.name" ,
598
- fmt .Sprintf (common .HelmParamImageTagAnnotation , "otherimg" ): "image.tag" ,
598
+ fmt .Sprintf (registryCommon . Prefixed ( common .ImageUpdaterAnnotationPrefix , registryCommon . HelmParamImageNameAnnotationSuffix ) , "otherimg" ): "image.name" ,
599
+ fmt .Sprintf (registryCommon . Prefixed ( common .ImageUpdaterAnnotationPrefix , registryCommon . HelmParamImageTagAnnotationSuffix ) , "otherimg" ): "image.tag" ,
599
600
}
600
601
name , tag := getHelmParamNamesFromAnnotation (annotations , & image.ContainerImage {
601
602
ImageAlias : "myimg" ,
@@ -606,7 +607,7 @@ func Test_GetHelmParamAnnotations(t *testing.T) {
606
607
607
608
t .Run ("Find existing image tag annotations" , func (t * testing.T ) {
608
609
annotations := map [string ]string {
609
- fmt .Sprintf (common .HelmParamImageTagAnnotation , "myimg" ): "image.tag" ,
610
+ fmt .Sprintf (registryCommon . Prefixed ( common .ImageUpdaterAnnotationPrefix , registryCommon . HelmParamImageTagAnnotationSuffix ) , "myimg" ): "image.tag" ,
610
611
}
611
612
name , tag := getHelmParamNamesFromAnnotation (annotations , & image.ContainerImage {
612
613
ImageAlias : "myimg" ,
@@ -795,7 +796,7 @@ func Test_SetKustomizeImage(t *testing.T) {
795
796
Name : "test-app" ,
796
797
Namespace : "testns" ,
797
798
Annotations : map [string ]string {
798
- fmt .Sprintf (common .KustomizeApplicationNameAnnotation , "foobar" ): "foobar" ,
799
+ fmt .Sprintf (registryCommon . Prefixed ( common .ImageUpdaterAnnotationPrefix , registryCommon . KustomizeApplicationNameAnnotationSuffix ) , "foobar" ): "foobar" ,
799
800
},
800
801
},
801
802
Spec : v1alpha1.ApplicationSpec {
@@ -833,8 +834,8 @@ func Test_SetHelmImage(t *testing.T) {
833
834
Name : "test-app" ,
834
835
Namespace : "testns" ,
835
836
Annotations : map [string ]string {
836
- fmt .Sprintf (common .HelmParamImageNameAnnotation , "foobar" ): "image.name" ,
837
- fmt .Sprintf (common .HelmParamImageTagAnnotation , "foobar" ): "image.tag" ,
837
+ fmt .Sprintf (registryCommon . Prefixed ( common .ImageUpdaterAnnotationPrefix , registryCommon . HelmParamImageNameAnnotationSuffix ) , "foobar" ): "image.name" ,
838
+ fmt .Sprintf (registryCommon . Prefixed ( common .ImageUpdaterAnnotationPrefix , registryCommon . HelmParamImageTagAnnotationSuffix ) , "foobar" ): "image.tag" ,
838
839
},
839
840
},
840
841
Spec : v1alpha1.ApplicationSpec {
@@ -887,8 +888,8 @@ func Test_SetHelmImage(t *testing.T) {
887
888
Name : "test-app" ,
888
889
Namespace : "testns" ,
889
890
Annotations : map [string ]string {
890
- fmt .Sprintf (common .HelmParamImageNameAnnotation , "foobar" ): "image.name" ,
891
- fmt .Sprintf (common .HelmParamImageTagAnnotation , "foobar" ): "image.tag" ,
891
+ fmt .Sprintf (registryCommon . Prefixed ( common .ImageUpdaterAnnotationPrefix , registryCommon . HelmParamImageNameAnnotationSuffix ) , "foobar" ): "image.name" ,
892
+ fmt .Sprintf (registryCommon . Prefixed ( common .ImageUpdaterAnnotationPrefix , registryCommon . HelmParamImageTagAnnotationSuffix ) , "foobar" ): "image.tag" ,
892
893
},
893
894
},
894
895
Spec : v1alpha1.ApplicationSpec {
@@ -930,8 +931,8 @@ func Test_SetHelmImage(t *testing.T) {
930
931
Name : "test-app" ,
931
932
Namespace : "testns" ,
932
933
Annotations : map [string ]string {
933
- fmt .Sprintf (common .HelmParamImageNameAnnotation , "foobar" ): "foobar.image.name" ,
934
- fmt .Sprintf (common .HelmParamImageTagAnnotation , "foobar" ): "foobar.image.tag" ,
934
+ fmt .Sprintf (registryCommon . Prefixed ( common .ImageUpdaterAnnotationPrefix , registryCommon . HelmParamImageNameAnnotationSuffix ) , "foobar" ): "foobar.image.name" ,
935
+ fmt .Sprintf (registryCommon . Prefixed ( common .ImageUpdaterAnnotationPrefix , registryCommon . HelmParamImageTagAnnotationSuffix ) , "foobar" ): "foobar.image.tag" ,
935
936
},
936
937
},
937
938
Spec : v1alpha1.ApplicationSpec {
@@ -984,8 +985,8 @@ func Test_SetHelmImage(t *testing.T) {
984
985
Name : "test-app" ,
985
986
Namespace : "testns" ,
986
987
Annotations : map [string ]string {
987
- fmt .Sprintf (common .HelmParamImageNameAnnotation , "foobar" ): "foobar.image.name" ,
988
- fmt .Sprintf (common .HelmParamImageTagAnnotation , "foobar" ): "foobar.image.tag" ,
988
+ fmt .Sprintf (registryCommon . Prefixed ( common .ImageUpdaterAnnotationPrefix , registryCommon . HelmParamImageNameAnnotationSuffix ) , "foobar" ): "foobar.image.name" ,
989
+ fmt .Sprintf (registryCommon . Prefixed ( common .ImageUpdaterAnnotationPrefix , registryCommon . HelmParamImageTagAnnotationSuffix ) , "foobar" ): "foobar.image.tag" ,
989
990
},
990
991
},
991
992
Spec : v1alpha1.ApplicationSpec {
@@ -1227,8 +1228,8 @@ func Test_parseImageList(t *testing.T) {
1227
1228
})
1228
1229
t .Run ("Test kustomize override" , func (t * testing.T ) {
1229
1230
imgs := * parseImageList (map [string ]string {
1230
- common .ImageUpdaterAnnotation : "foo=bar" ,
1231
- fmt .Sprintf (common .KustomizeApplicationNameAnnotation , "foo" ): "baz" ,
1231
+ common .ImageUpdaterAnnotation : "foo=bar" ,
1232
+ fmt .Sprintf (registryCommon . Prefixed ( common .ImageUpdaterAnnotationPrefix , registryCommon . KustomizeApplicationNameAnnotationSuffix ) , "foo" ): "baz" ,
1232
1233
})
1233
1234
assert .Equal (t , "bar" , imgs [0 ].ImageName )
1234
1235
assert .Equal (t , "baz" , imgs [0 ].KustomizeImage .ImageName )
0 commit comments