Also remove redundant code.
Signed-off-by: Zefan Li <lizefan@huawei.com>
| ... | ... |
@@ -5,7 +5,6 @@ import ( |
| 5 | 5 |
"io/ioutil" |
| 6 | 6 |
"net" |
| 7 | 7 |
"os" |
| 8 |
- "path" |
|
| 9 | 8 |
"path/filepath" |
| 10 | 9 |
"reflect" |
| 11 | 10 |
"testing" |
| ... | ... |
@@ -66,6 +65,7 @@ func TestFileSpecPlugin(t *testing.T) {
|
| 66 | 66 |
if err != nil {
|
| 67 | 67 |
t.Fatal(err) |
| 68 | 68 |
} |
| 69 |
+ defer os.RemoveAll(tmpdir) |
|
| 69 | 70 |
|
| 70 | 71 |
cases := []struct {
|
| 71 | 72 |
path string |
| ... | ... |
@@ -79,9 +79,6 @@ func TestFileSpecPlugin(t *testing.T) {
|
| 79 | 79 |
} |
| 80 | 80 |
|
| 81 | 81 |
for _, c := range cases {
|
| 82 |
- if err = os.MkdirAll(path.Dir(c.path), 0755); err != nil {
|
|
| 83 |
- t.Fatal(err) |
|
| 84 |
- } |
|
| 85 | 82 |
if err = ioutil.WriteFile(c.path, []byte(c.addr), 0644); err != nil {
|
| 86 | 83 |
t.Fatal(err) |
| 87 | 84 |
} |
| ... | ... |
@@ -103,6 +100,5 @@ func TestFileSpecPlugin(t *testing.T) {
|
| 103 | 103 |
if p.Addr != c.addr {
|
| 104 | 104 |
t.Fatalf("Expected plugin addr `%s`, got %s\n", c.addr, p.Addr)
|
| 105 | 105 |
} |
| 106 |
- os.Remove(c.path) |
|
| 107 | 106 |
} |
| 108 | 107 |
} |