github.com/mponton/terratest@v0.44.0/modules/helm/delete.go (about) 1 package helm 2 3 import ( 4 "github.com/mponton/terratest/modules/testing" 5 "github.com/stretchr/testify/require" 6 ) 7 8 // Delete will delete the provided release from Tiller. If you set purge to true, Tiller will delete the release object 9 // as well so that the release name can be reused. This will fail the test if there is an error. 10 func Delete(t testing.TestingT, options *Options, releaseName string, purge bool) { 11 require.NoError(t, DeleteE(t, options, releaseName, purge)) 12 } 13 14 // DeleteE will delete the provided release from Tiller. If you set purge to true, Tiller will delete the release object 15 // as well so that the release name can be reused. 16 func DeleteE(t testing.TestingT, options *Options, releaseName string, purge bool) error { 17 args := []string{} 18 if !purge { 19 args = append(args, "--keep-history") 20 } 21 if options.ExtraArgs != nil { 22 if deleteArgs, ok := options.ExtraArgs["delete"]; ok { 23 args = append(args, deleteArgs...) 24 } 25 } 26 args = append(args, releaseName) 27 _, err := RunHelmCommandAndGetOutputE(t, options, "delete", args...) 28 return err 29 }