66 "fmt"
77 "path/filepath"
88
9+ "github.com/kgateway-dev/kgateway/v2/pkg/utils/fsutils"
910 "helm.sh/helm/v3/pkg/repo"
1011
1112 "github.com/kgateway-dev/kgateway/v2/pkg/logging"
@@ -29,8 +30,25 @@ func GetLocalChartPath(chartName string, assetDir string) (string, error) {
2930 dir = defaultTestAssetDir
3031 }
3132 rootDir := testutils .GitRootDirectory ()
32- return filepath .Join (rootDir , "install/helm" , chartName ), nil
33+ testAssetDir := filepath .Join (rootDir , dir )
34+ if ! fsutils .IsDirectory (testAssetDir ) {
35+ return "" , fmt .Errorf ("%s does not exist or is not a directory" , testAssetDir )
36+ }
37+
38+ version , err := getChartVersion (testAssetDir , chartName )
39+ if err != nil {
40+ return "" , fmt .Errorf ("getting Helm chart version: %w" , err )
41+ }
42+ return filepath .Join (testAssetDir , fmt .Sprintf ("%s-%s.tgz" , chartName , version )), nil
3343}
44+ //func GetLocalChartPath(chartName string, assetDir string) (string, error) {
45+ // dir := assetDir
46+ // if dir == "" {
47+ // dir = defaultTestAssetDir
48+ // }
49+ // rootDir := testutils.GitRootDirectory()
50+ // return filepath.Join(rootDir, "install/helm", chartName), nil
51+ //}
3452
3553// Parses the Helm index file and returns the version of the chart.
3654func getChartVersion (testAssetDir string , chartName string ) (string , error ) {
0 commit comments