@@ -375,6 +375,59 @@ resources:
375
375
"component1/resource3.yaml" : {"git@github.com:testuser/testrepo.git" , "main" , "component1/resource3.yaml" },
376
376
},
377
377
},
378
+
379
+ "helm-dependencies-are-copied" : {
380
+ pullRequest : vcs.PullRequest {
381
+ CloneURL : "git@github.com:testuser/testrepo.git" ,
382
+ BaseRef : "main" ,
383
+ HeadRef : "update-code" ,
384
+ },
385
+ app : v1alpha1.Application {
386
+ Spec : v1alpha1.ApplicationSpec {
387
+ Sources : []v1alpha1.ApplicationSource {
388
+ {
389
+ RepoURL : "git@github.com:testuser/testrepo.git" ,
390
+ Path : "app1/" ,
391
+ TargetRevision : "main" ,
392
+ Helm : & v1alpha1.ApplicationSourceHelm {
393
+ ValueFiles : []string {
394
+ "values.yaml" ,
395
+ },
396
+ },
397
+ },
398
+ },
399
+ },
400
+ },
401
+ filesByRepo : map [repoTarget ]set [string ]{
402
+ repoTarget {"git@github.com:testuser/testrepo.git" , "main" }: newSet [string ](
403
+ "app1/values.yaml" ,
404
+ "app1/templates/deployment.yaml" ,
405
+ "charts/dependency/Chart.yaml" ,
406
+ "charts/dependency/values.yaml" ,
407
+ "charts/dependency/templates/deployment.yaml" ,
408
+ ),
409
+ },
410
+ filesByRepoWithContent : map [repoTarget ]map [string ]string {
411
+ repoTarget {"git@github.com:testuser/testrepo.git" , "main" }: {
412
+ "app1/Chart.yaml" : `---
413
+ apiVersion: v2
414
+ name: test-chart
415
+ version: 1.0.0
416
+ dependencies:
417
+ - name: dependency
418
+ version: 1.0.0
419
+ repository: file://../charts/dependency` ,
420
+ },
421
+ },
422
+ expectedFiles : map [string ]repoTargetPath {
423
+ "app1/Chart.yaml" : {"git@github.com:testuser/testrepo.git" , "main" , "app1/Chart.yaml" },
424
+ "app1/values.yaml" : {"git@github.com:testuser/testrepo.git" , "main" , "app1/values.yaml" },
425
+ "app1/templates/deployment.yaml" : {"git@github.com:testuser/testrepo.git" , "main" , "app1/templates/deployment.yaml" },
426
+ "charts/dependency/Chart.yaml" : {"git@github.com:testuser/testrepo.git" , "main" , "charts/dependency/Chart.yaml" },
427
+ "charts/dependency/values.yaml" : {"git@github.com:testuser/testrepo.git" , "main" , "charts/dependency/values.yaml" },
428
+ "charts/dependency/templates/deployment.yaml" : {"git@github.com:testuser/testrepo.git" , "main" , "charts/dependency/templates/deployment.yaml" },
429
+ },
430
+ },
378
431
}
379
432
380
433
for name , tc := range testCases {
@@ -466,11 +519,16 @@ func createTestRepos(
466
519
467
520
// ensure the directories exist
468
521
filedir := filepath .Dir (fullfilepath )
469
- err = os .MkdirAll (filedir , 0o755 )
522
+ err = os .MkdirAll (filedir , os . ModePerm )
470
523
require .NoError (t , err )
471
524
472
525
// generate and store content
473
526
fileContent := uuid .NewString ()
527
+ if filepath .Base (file ) == "Chart.yaml" {
528
+ fileContent = `apiVersion: v2
529
+ name: test-chart
530
+ version: 1.0.0`
531
+ }
474
532
fileContents [repoTargetPath {cloneURL .repo , cloneURL .target , file }] = fileContent
475
533
476
534
// write the file to disk
0 commit comments