99 "github.com/argoproj-labs/argocd-image-updater/pkg/common"
1010 "github.com/argoproj-labs/argocd-image-updater/pkg/kube"
1111
12+ registryCommon "github.com/argoproj-labs/argocd-image-updater/registry-scanner/pkg/common"
1213 "github.com/argoproj-labs/argocd-image-updater/registry-scanner/pkg/image"
1314 registryKube "github.com/argoproj-labs/argocd-image-updater/registry-scanner/pkg/kube"
1415
@@ -66,8 +67,8 @@ func Test_GetImagesFromApplication(t *testing.T) {
6667 Name : "test-app" ,
6768 Namespace : "argocd" ,
6869 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" ,
7172 },
7273 },
7374 Spec : v1alpha1.ApplicationSpec {},
@@ -558,8 +559,8 @@ func Test_FilterApplicationsForUpdate(t *testing.T) {
558559func Test_GetHelmParamAnnotations (t * testing.T ) {
559560 t .Run ("Get parameter names without symbolic names" , func (t * testing.T ) {
560561 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" ,
563564 }
564565 name , tag := getHelmParamNamesFromAnnotation (annotations , & image.ContainerImage {
565566 ImageAlias : "" ,
@@ -570,8 +571,8 @@ func Test_GetHelmParamAnnotations(t *testing.T) {
570571
571572 t .Run ("Find existing image spec annotation" , func (t * testing.T ) {
572573 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" ,
575576 }
576577 name , tag := getHelmParamNamesFromAnnotation (annotations , & image.ContainerImage {
577578 ImageAlias : "myimg" ,
@@ -582,8 +583,8 @@ func Test_GetHelmParamAnnotations(t *testing.T) {
582583
583584 t .Run ("Find existing image name and image tag annotations" , func (t * testing.T ) {
584585 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" ,
587588 }
588589 name , tag := getHelmParamNamesFromAnnotation (annotations , & image.ContainerImage {
589590 ImageAlias : "myimg" ,
@@ -594,8 +595,8 @@ func Test_GetHelmParamAnnotations(t *testing.T) {
594595
595596 t .Run ("Find non-existing image name and image tag annotations" , func (t * testing.T ) {
596597 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" ,
599600 }
600601 name , tag := getHelmParamNamesFromAnnotation (annotations , & image.ContainerImage {
601602 ImageAlias : "myimg" ,
@@ -606,7 +607,7 @@ func Test_GetHelmParamAnnotations(t *testing.T) {
606607
607608 t .Run ("Find existing image tag annotations" , func (t * testing.T ) {
608609 annotations := map [string ]string {
609- fmt .Sprintf (common .HelmParamImageTagAnnotation , "myimg" ): "image.tag" ,
610+ fmt .Sprintf (registryCommon . Prefixed ( common .ImageUpdaterAnnotationPrefix , registryCommon . HelmParamImageTagAnnotationSuffix ) , "myimg" ): "image.tag" ,
610611 }
611612 name , tag := getHelmParamNamesFromAnnotation (annotations , & image.ContainerImage {
612613 ImageAlias : "myimg" ,
@@ -795,7 +796,7 @@ func Test_SetKustomizeImage(t *testing.T) {
795796 Name : "test-app" ,
796797 Namespace : "testns" ,
797798 Annotations : map [string ]string {
798- fmt .Sprintf (common .KustomizeApplicationNameAnnotation , "foobar" ): "foobar" ,
799+ fmt .Sprintf (registryCommon . Prefixed ( common .ImageUpdaterAnnotationPrefix , registryCommon . KustomizeApplicationNameAnnotationSuffix ) , "foobar" ): "foobar" ,
799800 },
800801 },
801802 Spec : v1alpha1.ApplicationSpec {
@@ -833,8 +834,8 @@ func Test_SetHelmImage(t *testing.T) {
833834 Name : "test-app" ,
834835 Namespace : "testns" ,
835836 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" ,
838839 },
839840 },
840841 Spec : v1alpha1.ApplicationSpec {
@@ -887,8 +888,8 @@ func Test_SetHelmImage(t *testing.T) {
887888 Name : "test-app" ,
888889 Namespace : "testns" ,
889890 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" ,
892893 },
893894 },
894895 Spec : v1alpha1.ApplicationSpec {
@@ -930,8 +931,8 @@ func Test_SetHelmImage(t *testing.T) {
930931 Name : "test-app" ,
931932 Namespace : "testns" ,
932933 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" ,
935936 },
936937 },
937938 Spec : v1alpha1.ApplicationSpec {
@@ -984,8 +985,8 @@ func Test_SetHelmImage(t *testing.T) {
984985 Name : "test-app" ,
985986 Namespace : "testns" ,
986987 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" ,
989990 },
990991 },
991992 Spec : v1alpha1.ApplicationSpec {
@@ -1227,8 +1228,8 @@ func Test_parseImageList(t *testing.T) {
12271228 })
12281229 t .Run ("Test kustomize override" , func (t * testing.T ) {
12291230 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" ,
12321233 })
12331234 assert .Equal (t , "bar" , imgs [0 ].ImageName )
12341235 assert .Equal (t , "baz" , imgs [0 ].KustomizeImage .ImageName )
0 commit comments