fix test command for helm 3 (#1080)

This commit is contained in:
Christoph Hösler 2020-02-03 00:41:38 +01:00 committed by GitHub
parent c8ba676e19
commit 9fab6851f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -168,6 +168,11 @@ func (a *App) Destroy(c DestroyConfigProvider) error {
}
func (a *App) Test(c TestConfigProvider) error {
if c.Cleanup() && a.helmExecer.IsHelm3() {
a.Logger.Warnf("warn: requested cleanup will not be applied. " +
"To clean up test resources with Helm 3, you have to remove them manually " +
"or set helm.sh/hook-delete-policy\n")
}
return a.ForEachStateFiltered(func(run *Run) []error {
return run.Test(c)
})

View File

@ -1206,7 +1206,10 @@ func (st *HelmState) TestReleases(helm helmexec.Interface, cleanup bool, timeout
}
flags := []string{}
if cleanup {
if helm.IsHelm3() && release.Namespace != "" {
flags = append(flags, "--namespace", release.Namespace)
}
if cleanup && !helm.IsHelm3() {
flags = append(flags, "--cleanup")
}
duration := strconv.Itoa(timeout)