@@ -466,6 +466,41 @@ func Test_SetKustomizeImage(t *testing.T) {
466466 require .Error (t , err )
467467 })
468468
469+ t .Run ("Test set Kustomize image parameters with alias name on Kustomize app with param already set" , func (t * testing.T ) {
470+ app := & v1alpha1.Application {
471+ ObjectMeta : v1.ObjectMeta {
472+ Name : "test-app" ,
473+ Namespace : "testns" ,
474+ Annotations : map [string ]string {
475+ fmt .Sprintf (common .KustomizeApplicationNameAnnotation , "foobar" ): "foobar" ,
476+ },
477+ },
478+ Spec : v1alpha1.ApplicationSpec {
479+ Source : v1alpha1.ApplicationSource {
480+ Kustomize : & v1alpha1.ApplicationSourceKustomize {
481+ Images : v1alpha1.KustomizeImages {
482+ "jannfis/foobar:1.0.0" ,
483+ },
484+ },
485+ },
486+ },
487+ Status : v1alpha1.ApplicationStatus {
488+ SourceType : v1alpha1 .ApplicationSourceTypeKustomize ,
489+ Summary : v1alpha1.ApplicationSummary {
490+ Images : []string {
491+ "jannfis/foobar:1.0.0" ,
492+ },
493+ },
494+ },
495+ }
496+ img := image .NewFromIdentifier ("foobar=jannfis/foobar:1.0.1" )
497+ err := SetKustomizeImage (app , img )
498+ require .NoError (t , err )
499+ require .NotNil (t , app .Spec .Source .Kustomize )
500+ assert .Len (t , app .Spec .Source .Kustomize .Images , 1 )
501+ assert .Equal (t , v1alpha1 .KustomizeImage ("foobar=jannfis/foobar:1.0.1" ), app .Spec .Source .Kustomize .Images [0 ])
502+ })
503+
469504}
470505
471506func Test_SetHelmImage (t * testing.T ) {
0 commit comments