@@ -44,7 +44,9 @@ func TestKustomizeBuild(t *testing.T) {
44
44
namePrefix := "namePrefix-"
45
45
nameSuffix := "-nameSuffix"
46
46
namespace := "custom-namespace"
47
- kustomize := NewKustomizeApp (appPath , appPath , git.NopCreds {}, "" , "" , "" , "" )
47
+ repoRoot , err := os .OpenRoot (appPath )
48
+ require .NoError (t , err )
49
+ kustomize := NewKustomizeApp (repoRoot , appPath , git.NopCreds {}, "" , "" , "" , "" )
48
50
env := & v1alpha1.Env {
49
51
& v1alpha1.EnvEntry {Name : "ARGOCD_APP_NAME" , Value : "argo-cd-tests" },
50
52
}
@@ -128,7 +130,9 @@ func TestKustomizeBuild(t *testing.T) {
128
130
func TestFailKustomizeBuild (t * testing.T ) {
129
131
appPath , err := testDataDir (t , kustomization1 )
130
132
require .NoError (t , err )
131
- kustomize := NewKustomizeApp (appPath , appPath , git.NopCreds {}, "" , "" , "" , "" )
133
+ repoRoot , err := os .OpenRoot (appPath )
134
+ require .NoError (t , err )
135
+ kustomize := NewKustomizeApp (repoRoot , appPath , git.NopCreds {}, "" , "" , "" , "" )
132
136
kustomizeSource := v1alpha1.ApplicationSourceKustomize {
133
137
Replicas : []v1alpha1.KustomizeReplica {
134
138
{
@@ -237,7 +241,9 @@ func TestKustomizeBuildForceCommonLabels(t *testing.T) {
237
241
for _ , tc := range testCases {
238
242
appPath , err := testDataDir (t , tc .TestData )
239
243
require .NoError (t , err )
240
- kustomize := NewKustomizeApp (appPath , appPath , git.NopCreds {}, "" , "" , "" , "" )
244
+ repoRoot , err := os .OpenRoot (appPath )
245
+ require .NoError (t , err )
246
+ kustomize := NewKustomizeApp (repoRoot , appPath , git.NopCreds {}, "" , "" , "" , "" )
241
247
objs , _ , _ , err := kustomize .Build (& tc .KustomizeSource , nil , tc .Env , nil )
242
248
switch tc .ExpectErr {
243
249
case true :
@@ -329,7 +335,9 @@ func TestKustomizeBuildForceCommonAnnotations(t *testing.T) {
329
335
for _ , tc := range testCases {
330
336
appPath , err := testDataDir (t , tc .TestData )
331
337
require .NoError (t , err )
332
- kustomize := NewKustomizeApp (appPath , appPath , git.NopCreds {}, "" , "" , "" , "" )
338
+ repoRoot , err := os .OpenRoot (appPath )
339
+ require .NoError (t , err )
340
+ kustomize := NewKustomizeApp (repoRoot , appPath , git.NopCreds {}, "" , "" , "" , "" )
333
341
objs , _ , _ , err := kustomize .Build (& tc .KustomizeSource , nil , tc .Env , nil )
334
342
switch tc .ExpectErr {
335
343
case true :
@@ -435,7 +443,9 @@ func TestKustomizeLabelWithoutSelector(t *testing.T) {
435
443
for _ , tc := range testCases {
436
444
appPath , err := testDataDir (t , tc .TestData )
437
445
require .NoError (t , err )
438
- kustomize := NewKustomizeApp (appPath , appPath , git.NopCreds {}, "" , "" , "" , "" )
446
+ repoRoot , err := os .OpenRoot (appPath )
447
+ require .NoError (t , err )
448
+ kustomize := NewKustomizeApp (repoRoot , appPath , git.NopCreds {}, "" , "" , "" , "" )
439
449
objs , _ , _ , err := kustomize .Build (& tc .KustomizeSource , nil , tc .Env , nil )
440
450
441
451
switch tc .ExpectErr {
@@ -465,7 +475,9 @@ func TestKustomizeCustomVersion(t *testing.T) {
465
475
kustomizePath , err := testDataDir (t , kustomization4 )
466
476
require .NoError (t , err )
467
477
envOutputFile := kustomizePath + "/env_output"
468
- kustomize := NewKustomizeApp (appPath , appPath , git.NopCreds {}, "" , kustomizePath + "/kustomize.special" , "" , "" )
478
+ repoRoot , err := os .OpenRoot (appPath )
479
+ require .NoError (t , err )
480
+ kustomize := NewKustomizeApp (repoRoot , appPath , git.NopCreds {}, "" , kustomizePath + "/kustomize.special" , "" , "" )
469
481
kustomizeSource := v1alpha1.ApplicationSourceKustomize {
470
482
Version : "special" ,
471
483
}
@@ -487,7 +499,9 @@ func TestKustomizeCustomVersion(t *testing.T) {
487
499
func TestKustomizeBuildComponents (t * testing.T ) {
488
500
appPath , err := testDataDir (t , kustomization6 )
489
501
require .NoError (t , err )
490
- kustomize := NewKustomizeApp (appPath , appPath , git.NopCreds {}, "" , "" , "" , "" )
502
+ repoRoot , err := os .OpenRoot (appPath )
503
+ require .NoError (t , err )
504
+ kustomize := NewKustomizeApp (repoRoot , appPath , git.NopCreds {}, "" , "" , "" , "" )
491
505
492
506
kustomizeSource := v1alpha1.ApplicationSourceKustomize {
493
507
Components : []string {"./components" , "./missing-components" },
@@ -517,7 +531,9 @@ func TestKustomizeBuildComponentsMonoRepo(t *testing.T) {
517
531
rootPath , err := testDataDir (t , kustomization9 )
518
532
require .NoError (t , err )
519
533
appPath := path .Join (rootPath , "envs/inseng-pdx-egert-sandbox/namespaces/inst-system/apps/hello-world" )
520
- kustomize := NewKustomizeApp (rootPath , appPath , git.NopCreds {}, "" , "" , "" , "" )
534
+ repoRoot , err := os .OpenRoot (rootPath )
535
+ require .NoError (t , err )
536
+ kustomize := NewKustomizeApp (repoRoot , appPath , git.NopCreds {}, "" , "" , "" , "" )
521
537
kustomizeSource := v1alpha1.ApplicationSourceKustomize {
522
538
Components : []string {"../../../../../../kustomize/components/all" },
523
539
IgnoreMissingComponents : true ,
@@ -541,7 +557,9 @@ func TestKustomizeBuildComponentsMonoRepo(t *testing.T) {
541
557
func TestKustomizeBuildPatches (t * testing.T ) {
542
558
appPath , err := testDataDir (t , kustomization5 )
543
559
require .NoError (t , err )
544
- kustomize := NewKustomizeApp (appPath , appPath , git.NopCreds {}, "" , "" , "" , "" )
560
+ repoRoot , err := os .OpenRoot (appPath )
561
+ require .NoError (t , err )
562
+ kustomize := NewKustomizeApp (repoRoot , appPath , git.NopCreds {}, "" , "" , "" , "" )
545
563
546
564
kustomizeSource := v1alpha1.ApplicationSourceKustomize {
547
565
Patches : []v1alpha1.KustomizePatch {
@@ -593,7 +611,9 @@ func TestKustomizeBuildPatches(t *testing.T) {
593
611
func TestFailKustomizeBuildPatches (t * testing.T ) {
594
612
appPath , err := testDataDir (t , kustomization8 )
595
613
require .NoError (t , err )
596
- kustomize := NewKustomizeApp (appPath , appPath , git.NopCreds {}, "" , "" , "" , "" )
614
+ repoRoot , err := os .OpenRoot (appPath )
615
+ require .NoError (t , err )
616
+ kustomize := NewKustomizeApp (repoRoot , appPath , git.NopCreds {}, "" , "" , "" , "" )
597
617
598
618
kustomizeSource := v1alpha1.ApplicationSourceKustomize {
599
619
Patches : []v1alpha1.KustomizePatch {
@@ -618,7 +638,9 @@ func TestFailKustomizeBuildPatches(t *testing.T) {
618
638
func TestKustomizeBuildComponentsNoFoundComponents (t * testing.T ) {
619
639
appPath , err := testDataDir (t , kustomization6 )
620
640
require .NoError (t , err )
621
- kustomize := NewKustomizeApp (appPath , appPath , git.NopCreds {}, "" , "" , "" , "" )
641
+ repoRoot , err := os .OpenRoot (appPath )
642
+ require .NoError (t , err )
643
+ kustomize := NewKustomizeApp (repoRoot , appPath , git.NopCreds {}, "" , "" , "" , "" )
622
644
623
645
// Test with non-existent components and IgnoreMissingComponents = true
624
646
// This should result in foundComponents being empty, so no "edit add component" command should be executed
0 commit comments