Merge pull request #3507 from adshmh/fix-left-over-helm-home-dirs-from-unit-tests

Fix the unit tests to avoid leaving behind 'helm_home*' temporary directories during build
pull/2824/head
Matthew Fisher 7 years ago committed by GitHub
commit 5ddf2f36c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -46,7 +46,7 @@ func TestInitCmd(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
defer os.Remove(home) defer os.RemoveAll(home)
var buf bytes.Buffer var buf bytes.Buffer
fc := fake.NewSimpleClientset() fc := fake.NewSimpleClientset()
@ -80,7 +80,7 @@ func TestInitCmd_exists(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
defer os.Remove(home) defer os.RemoveAll(home)
var buf bytes.Buffer var buf bytes.Buffer
fc := fake.NewSimpleClientset(&v1beta1.Deployment{ fc := fake.NewSimpleClientset(&v1beta1.Deployment{
@ -113,7 +113,7 @@ func TestInitCmd_clientOnly(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
defer os.Remove(home) defer os.RemoveAll(home)
var buf bytes.Buffer var buf bytes.Buffer
fc := fake.NewSimpleClientset() fc := fake.NewSimpleClientset()
@ -184,7 +184,7 @@ func TestEnsureHome(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
defer os.Remove(home) defer os.RemoveAll(home)
b := bytes.NewBuffer(nil) b := bytes.NewBuffer(nil)
hh := helmpath.Home(home) hh := helmpath.Home(home)

@ -37,7 +37,7 @@ func TestUpdateCmd(t *testing.T) {
cleanup := resetEnv() cleanup := resetEnv()
defer func() { defer func() {
os.Remove(thome.String()) os.RemoveAll(thome.String())
cleanup() cleanup()
}() }()

Loading…
Cancel
Save