@@ -615,6 +615,26 @@ func TestFailKustomizeBuildPatches(t *testing.T) {
615
615
require .EqualError (t , err , "kustomization file not found in the path" )
616
616
}
617
617
618
+ func TestKustomizeBuildComponentsNoFoundComponents (t * testing.T ) {
619
+ appPath , err := testDataDir (t , kustomization6 )
620
+ require .NoError (t , err )
621
+ kustomize := NewKustomizeApp (appPath , appPath , git.NopCreds {}, "" , "" , "" , "" )
622
+
623
+ // Test with non-existent components and IgnoreMissingComponents = true
624
+ // This should result in foundComponents being empty, so no "edit add component" command should be executed
625
+ kustomizeSource := v1alpha1.ApplicationSourceKustomize {
626
+ Components : []string {"./non-existent-component1" , "./non-existent-component2" },
627
+ IgnoreMissingComponents : true ,
628
+ }
629
+ _ , _ , commands , err := kustomize .Build (& kustomizeSource , nil , nil , nil )
630
+ require .NoError (t , err )
631
+
632
+ // Verify that no "edit add component" command was executed
633
+ for _ , cmd := range commands {
634
+ assert .NotContains (t , cmd , "edit add component" , "kustomize edit add component should not be invoked when foundComponents is empty" )
635
+ }
636
+ }
637
+
618
638
func Test_getImageParameters_sorted (t * testing.T ) {
619
639
apps := []* unstructured.Unstructured {
620
640
{
0 commit comments