diff --git a/pkg/app/app.go b/pkg/app/app.go index b07f92df..ebb6cc70 100644 --- a/pkg/app/app.go +++ b/pkg/app/app.go @@ -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) }) diff --git a/pkg/state/state.go b/pkg/state/state.go index b5d9f528..b413018b 100644 --- a/pkg/state/state.go +++ b/pkg/state/state.go @@ -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)