fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero 2023-04-28 10:07:25 +08:00
parent 3f86b74437
commit 0c1fca8f32
5 changed files with 50 additions and 5 deletions

View File

@ -67,7 +67,7 @@ func (st *HelmState) goGetterChart(chart, dir, cacheDir string, force bool) (str
}
if filepath.IsAbs(chart) || strings.HasPrefix(chart, ".") {
return chart, fmt.Errorf("chart path %q not found", chart)
return "", fmt.Errorf("chart path %s not found", chart)
}
if strings.HasPrefix(chart, "oci://") {
@ -136,10 +136,6 @@ func (st *HelmState) PrepareChartify(helm helmexec.Interface, release *ReleaseSp
}
}
if filepath.IsAbs(dependenceChart) {
dependenceChart = fmt.Sprintf("file://%s", dependenceChart)
}
c.Opts.AdhocChartDependencies = append(c.Opts.AdhocChartDependencies, chartify.ChartDependency{
Alias: d.Alias,
Chart: dependenceChart,

View File

@ -28,6 +28,34 @@ func TestGoGetter(t *testing.T) {
out: "raw/incubator",
err: "",
},
{
chart: "oci://my-oci-registry/helm-repo/envoy",
dir: "",
force: false,
out: "oci://my-oci-registry/helm-repo/envoy",
err: "",
},
{
chart: "testdata",
dir: "",
force: false,
out: "testdata",
err: "",
},
{
chart: "./testdata",
dir: "",
force: false,
out: "./testdata",
err: "",
},
{
chart: "./noexist",
dir: "",
force: false,
out: "",
err: "chart path ./noexist not found",
},
}
for i, tc := range testcases {

View File

@ -0,0 +1,3 @@
helmfileArgs:
- template
- --concurrency=1

View File

@ -0,0 +1,18 @@
helmDefaults:
wait: false
cleanupOnFail: true
createNamespace: true
repositories:
- name: prometheus-community
url: https://prometheus-community.github.io/helm-charts
releases:
- name: kube-prometheus-stack
namespace: monitoring
chart: prometheus-community/kube-prometheus-stack
version: 45.17.0
disableValidationOnInstall: true
dependencies:
- chart: "git::https://github.com/goharbor/harbor-helm.git@"
version: 0.64.1