summaryrefslogtreecommitdiff
path: root/pkg/argocd/argocd_test.go
diff options
context:
space:
mode:
authorIshita Sequeira <46771830+ishitasequeira@users.noreply.github.com>2025-01-14 20:20:42 -0500
committerGitHub <noreply@github.com>2025-01-14 20:20:42 -0500
commit9affc2119baee1307a9d362b14e35712ac778f82 (patch)
tree4a47acf13498a3b0148619ee91d7a9adca59af88 /pkg/argocd/argocd_test.go
parent10a01f381aa7d55e9806c7e8df75fee78976cebc (diff)
Replace common constant references (#1011)HEADmaster
Signed-off-by: Ishita Sequeira <ishiseq29@gmail.com>
Diffstat (limited to 'pkg/argocd/argocd_test.go')
-rw-r--r--pkg/argocd/argocd_test.go45
1 files changed, 23 insertions, 22 deletions
diff --git a/pkg/argocd/argocd_test.go b/pkg/argocd/argocd_test.go
index 3876da0..1c9b944 100644
--- a/pkg/argocd/argocd_test.go
+++ b/pkg/argocd/argocd_test.go
@@ -9,6 +9,7 @@ import (
"github.com/argoproj-labs/argocd-image-updater/pkg/common"
"github.com/argoproj-labs/argocd-image-updater/pkg/kube"
+ registryCommon "github.com/argoproj-labs/argocd-image-updater/registry-scanner/pkg/common"
"github.com/argoproj-labs/argocd-image-updater/registry-scanner/pkg/image"
registryKube "github.com/argoproj-labs/argocd-image-updater/registry-scanner/pkg/kube"
@@ -66,8 +67,8 @@ func Test_GetImagesFromApplication(t *testing.T) {
Name: "test-app",
Namespace: "argocd",
Annotations: map[string]string{
- fmt.Sprintf(common.ForceUpdateOptionAnnotation, "nginx"): "true",
- common.ImageUpdaterAnnotation: "nginx=nginx",
+ fmt.Sprintf(registryCommon.Prefixed(common.ImageUpdaterAnnotationPrefix, registryCommon.ForceUpdateOptionAnnotationSuffix), "nginx"): "true",
+ common.ImageUpdaterAnnotation: "nginx=nginx",
},
},
Spec: v1alpha1.ApplicationSpec{},
@@ -558,8 +559,8 @@ func Test_FilterApplicationsForUpdate(t *testing.T) {
func Test_GetHelmParamAnnotations(t *testing.T) {
t.Run("Get parameter names without symbolic names", func(t *testing.T) {
annotations := map[string]string{
- fmt.Sprintf(common.HelmParamImageSpecAnnotation, "myimg"): "image.blub",
- fmt.Sprintf(common.HelmParamImageTagAnnotation, "myimg"): "image.blab",
+ fmt.Sprintf(registryCommon.Prefixed(common.ImageUpdaterAnnotationPrefix, registryCommon.HelmParamImageSpecAnnotationSuffix), "myimg"): "image.blub",
+ fmt.Sprintf(registryCommon.Prefixed(common.ImageUpdaterAnnotationPrefix, registryCommon.HelmParamImageTagAnnotationSuffix), "myimg"): "image.blab",
}
name, tag := getHelmParamNamesFromAnnotation(annotations, &image.ContainerImage{
ImageAlias: "",
@@ -570,8 +571,8 @@ func Test_GetHelmParamAnnotations(t *testing.T) {
t.Run("Find existing image spec annotation", func(t *testing.T) {
annotations := map[string]string{
- fmt.Sprintf(common.HelmParamImageSpecAnnotation, "myimg"): "image.path",
- fmt.Sprintf(common.HelmParamImageTagAnnotation, "myimg"): "image.tag",
+ fmt.Sprintf(registryCommon.Prefixed(common.ImageUpdaterAnnotationPrefix, registryCommon.HelmParamImageSpecAnnotationSuffix), "myimg"): "image.path",
+ fmt.Sprintf(registryCommon.Prefixed(common.ImageUpdaterAnnotationPrefix, registryCommon.HelmParamImageTagAnnotationSuffix), "myimg"): "image.tag",
}
name, tag := getHelmParamNamesFromAnnotation(annotations, &image.ContainerImage{
ImageAlias: "myimg",
@@ -582,8 +583,8 @@ func Test_GetHelmParamAnnotations(t *testing.T) {
t.Run("Find existing image name and image tag annotations", func(t *testing.T) {
annotations := map[string]string{
- fmt.Sprintf(common.HelmParamImageNameAnnotation, "myimg"): "image.name",
- fmt.Sprintf(common.HelmParamImageTagAnnotation, "myimg"): "image.tag",
+ fmt.Sprintf(registryCommon.Prefixed(common.ImageUpdaterAnnotationPrefix, registryCommon.HelmParamImageNameAnnotationSuffix), "myimg"): "image.name",
+ fmt.Sprintf(registryCommon.Prefixed(common.ImageUpdaterAnnotationPrefix, registryCommon.HelmParamImageTagAnnotationSuffix), "myimg"): "image.tag",
}
name, tag := getHelmParamNamesFromAnnotation(annotations, &image.ContainerImage{
ImageAlias: "myimg",
@@ -594,8 +595,8 @@ func Test_GetHelmParamAnnotations(t *testing.T) {
t.Run("Find non-existing image name and image tag annotations", func(t *testing.T) {
annotations := map[string]string{
- fmt.Sprintf(common.HelmParamImageNameAnnotation, "otherimg"): "image.name",
- fmt.Sprintf(common.HelmParamImageTagAnnotation, "otherimg"): "image.tag",
+ fmt.Sprintf(registryCommon.Prefixed(common.ImageUpdaterAnnotationPrefix, registryCommon.HelmParamImageNameAnnotationSuffix), "otherimg"): "image.name",
+ fmt.Sprintf(registryCommon.Prefixed(common.ImageUpdaterAnnotationPrefix, registryCommon.HelmParamImageTagAnnotationSuffix), "otherimg"): "image.tag",
}
name, tag := getHelmParamNamesFromAnnotation(annotations, &image.ContainerImage{
ImageAlias: "myimg",
@@ -606,7 +607,7 @@ func Test_GetHelmParamAnnotations(t *testing.T) {
t.Run("Find existing image tag annotations", func(t *testing.T) {
annotations := map[string]string{
- fmt.Sprintf(common.HelmParamImageTagAnnotation, "myimg"): "image.tag",
+ fmt.Sprintf(registryCommon.Prefixed(common.ImageUpdaterAnnotationPrefix, registryCommon.HelmParamImageTagAnnotationSuffix), "myimg"): "image.tag",
}
name, tag := getHelmParamNamesFromAnnotation(annotations, &image.ContainerImage{
ImageAlias: "myimg",
@@ -795,7 +796,7 @@ func Test_SetKustomizeImage(t *testing.T) {
Name: "test-app",
Namespace: "testns",
Annotations: map[string]string{
- fmt.Sprintf(common.KustomizeApplicationNameAnnotation, "foobar"): "foobar",
+ fmt.Sprintf(registryCommon.Prefixed(common.ImageUpdaterAnnotationPrefix, registryCommon.KustomizeApplicationNameAnnotationSuffix), "foobar"): "foobar",
},
},
Spec: v1alpha1.ApplicationSpec{
@@ -833,8 +834,8 @@ func Test_SetHelmImage(t *testing.T) {
Name: "test-app",
Namespace: "testns",
Annotations: map[string]string{
- fmt.Sprintf(common.HelmParamImageNameAnnotation, "foobar"): "image.name",
- fmt.Sprintf(common.HelmParamImageTagAnnotation, "foobar"): "image.tag",
+ fmt.Sprintf(registryCommon.Prefixed(common.ImageUpdaterAnnotationPrefix, registryCommon.HelmParamImageNameAnnotationSuffix), "foobar"): "image.name",
+ fmt.Sprintf(registryCommon.Prefixed(common.ImageUpdaterAnnotationPrefix, registryCommon.HelmParamImageTagAnnotationSuffix), "foobar"): "image.tag",
},
},
Spec: v1alpha1.ApplicationSpec{
@@ -887,8 +888,8 @@ func Test_SetHelmImage(t *testing.T) {
Name: "test-app",
Namespace: "testns",
Annotations: map[string]string{
- fmt.Sprintf(common.HelmParamImageNameAnnotation, "foobar"): "image.name",
- fmt.Sprintf(common.HelmParamImageTagAnnotation, "foobar"): "image.tag",
+ fmt.Sprintf(registryCommon.Prefixed(common.ImageUpdaterAnnotationPrefix, registryCommon.HelmParamImageNameAnnotationSuffix), "foobar"): "image.name",
+ fmt.Sprintf(registryCommon.Prefixed(common.ImageUpdaterAnnotationPrefix, registryCommon.HelmParamImageTagAnnotationSuffix), "foobar"): "image.tag",
},
},
Spec: v1alpha1.ApplicationSpec{
@@ -930,8 +931,8 @@ func Test_SetHelmImage(t *testing.T) {
Name: "test-app",
Namespace: "testns",
Annotations: map[string]string{
- fmt.Sprintf(common.HelmParamImageNameAnnotation, "foobar"): "foobar.image.name",
- fmt.Sprintf(common.HelmParamImageTagAnnotation, "foobar"): "foobar.image.tag",
+ fmt.Sprintf(registryCommon.Prefixed(common.ImageUpdaterAnnotationPrefix, registryCommon.HelmParamImageNameAnnotationSuffix), "foobar"): "foobar.image.name",
+ fmt.Sprintf(registryCommon.Prefixed(common.ImageUpdaterAnnotationPrefix, registryCommon.HelmParamImageTagAnnotationSuffix), "foobar"): "foobar.image.tag",
},
},
Spec: v1alpha1.ApplicationSpec{
@@ -984,8 +985,8 @@ func Test_SetHelmImage(t *testing.T) {
Name: "test-app",
Namespace: "testns",
Annotations: map[string]string{
- fmt.Sprintf(common.HelmParamImageNameAnnotation, "foobar"): "foobar.image.name",
- fmt.Sprintf(common.HelmParamImageTagAnnotation, "foobar"): "foobar.image.tag",
+ fmt.Sprintf(registryCommon.Prefixed(common.ImageUpdaterAnnotationPrefix, registryCommon.HelmParamImageNameAnnotationSuffix), "foobar"): "foobar.image.name",
+ fmt.Sprintf(registryCommon.Prefixed(common.ImageUpdaterAnnotationPrefix, registryCommon.HelmParamImageTagAnnotationSuffix), "foobar"): "foobar.image.tag",
},
},
Spec: v1alpha1.ApplicationSpec{
@@ -1227,8 +1228,8 @@ func Test_parseImageList(t *testing.T) {
})
t.Run("Test kustomize override", func(t *testing.T) {
imgs := *parseImageList(map[string]string{
- common.ImageUpdaterAnnotation: "foo=bar",
- fmt.Sprintf(common.KustomizeApplicationNameAnnotation, "foo"): "baz",
+ common.ImageUpdaterAnnotation: "foo=bar",
+ fmt.Sprintf(registryCommon.Prefixed(common.ImageUpdaterAnnotationPrefix, registryCommon.KustomizeApplicationNameAnnotationSuffix), "foo"): "baz",
})
assert.Equal(t, "bar", imgs[0].ImageName)
assert.Equal(t, "baz", imgs[0].KustomizeImage.ImageName)