fix more test

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero 2026-03-16 08:53:32 +08:00
parent 669abf4de6
commit 1ebeba01a7
3 changed files with 15 additions and 10 deletions

View File

@ -385,8 +385,8 @@ dependencies:
- name: redis
repository: https://charts.bitnami.com/bitnami
version: 17.0.7
digest: sha256:abc123
generated: "2024-01-01T00:00:00Z"
digest: sha256:abc123
generated: "2024-01-01T00:00:00Z"
`,
"/path/to/helmfile.d/second.yaml": `
repositories:
@ -404,8 +404,8 @@ dependencies:
- name: nginx
repository: https://charts.bitnami.com/bitnami
version: 15.0.0
digest: sha256:def456
generated: "2024-01-01T00:00:00Z"
digest: sha256:def456
generated: "2024-01-01T00:00:00Z"
`,
}

View File

@ -265,8 +265,13 @@ func getUnresolvedDependenciess(st *HelmState) (string, *UnresolvedDependencies)
func updateDependencies(st *HelmState, shell helmexec.DependencyUpdater, unresolved *UnresolvedDependencies, filename, wd string) (*HelmState, error) {
lockFile := st.LockFile
if lockFile != "" && st.basePath != "" && !filepath.IsAbs(lockFile) {
lockFile = filepath.Join(st.basePath, lockFile)
switch {
case lockFile != "":
if st.basePath != "" && !filepath.IsAbs(lockFile) {
lockFile = filepath.Join(st.basePath, lockFile)
}
case st.basePath != "":
lockFile = filepath.Join(st.basePath, filename+".lock")
}
depMan := NewChartDependencyManager(filename, st.logger, lockFile)

View File

@ -2548,10 +2548,10 @@ generated: 2019-05-16T15:42:45.50486+09:00
}
logger := helmexec.NewLogger(io.Discard, "debug")
basePath := "/src"
basePath := t.TempDir()
state := &HelmState{
basePath: basePath,
FilePath: "/src/helmfile.yaml",
FilePath: filepath.Join(basePath, "helmfile.yaml"),
ReleaseSetSpec: ReleaseSetSpec{
Releases: []ReleaseSpec{
{
@ -2584,8 +2584,8 @@ generated: 2019-05-16T15:42:45.50486+09:00
}
fs := testhelper.NewTestFs(map[string]string{
"/example/Chart.yaml": `foo: FOO`,
"/src/example/Chart.yaml": `foo: FOO`,
"/example/Chart.yaml": `foo: FOO`,
filepath.Join(basePath, "example/Chart.yaml"): `foo: FOO`,
})
fs.Cwd = basePath
state = injectFs(state, fs)