Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
bagnaram committed Oct 16, 2023
1 parent 0d9d265 commit b23cc86
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion reposerver/repository/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -2092,7 +2092,7 @@ func walkHelmValueFilesInPath(root string, valuesFiles *[]string) filepath.WalkF
if strings.Contains(filename, "values") && (fileNameExt == ".yaml" || fileNameExt == ".yml") {
relPath, err := filepath.Rel(root, path)
if err != nil {
return fmt.Errorf("error traversing path from %s: %w", path, err)
return fmt.Errorf("error traversing path from %s to %s: %w", root, path, err)
}
*valuesFiles = append(*valuesFiles, relPath)
}
Expand Down
7 changes: 7 additions & 0 deletions reposerver/repository/repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2678,6 +2678,13 @@ func Test_walkHelmValueFilesInPath(t *testing.T) {
assert.NoError(t, err)
assert.Len(t, files, 4)
})
t.Run("unrelated root", func(t *testing.T) {
var files []string
root := "./testdata/values-files"
unrelated_root := "/different/root/path"
err := filepath.Walk(root, walkHelmValueFilesInPath(unrelated_root, &files))
assert.Error(t, err)
})
}

func Test_populateHelmAppDetails(t *testing.T) {
Expand Down

0 comments on commit b23cc86

Please sign in to comment.