From d31224743b31b3e29ed7df0835193ff1ac4e723c Mon Sep 17 00:00:00 2001 From: Zefan Li Date: Thu, 4 Jun 2015 13:21:28 +0800 Subject: [PATCH] Don't forget to clenaup tmpdir in TestFileSpecPlugin() Also remove redundant code. Signed-off-by: Zefan Li --- pkg/plugins/discovery_test.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pkg/plugins/discovery_test.go b/pkg/plugins/discovery_test.go index b6e66e289c..a818dc3f3c 100644 --- a/pkg/plugins/discovery_test.go +++ b/pkg/plugins/discovery_test.go @@ -5,7 +5,6 @@ import ( "io/ioutil" "net" "os" - "path" "path/filepath" "reflect" "testing" @@ -66,6 +65,7 @@ func TestFileSpecPlugin(t *testing.T) { if err != nil { t.Fatal(err) } + defer os.RemoveAll(tmpdir) cases := []struct { path string @@ -79,9 +79,6 @@ func TestFileSpecPlugin(t *testing.T) { } for _, c := range cases { - if err = os.MkdirAll(path.Dir(c.path), 0755); err != nil { - t.Fatal(err) - } if err = ioutil.WriteFile(c.path, []byte(c.addr), 0644); err != nil { t.Fatal(err) } @@ -103,6 +100,5 @@ func TestFileSpecPlugin(t *testing.T) { if p.Addr != c.addr { t.Fatalf("Expected plugin addr `%s`, got %s\n", c.addr, p.Addr) } - os.Remove(c.path) } }