remove temporary dir
The temporary directory had better to be removed after test case finished. Signed-off-by: xiekeyang <xiekeyang@huawei.com>
This commit is contained in:
parent
d41f146eed
commit
e78e921fc1
@ -2,6 +2,7 @@ package fs
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
_ "crypto/sha256"
|
_ "crypto/sha256"
|
||||||
@ -36,10 +37,13 @@ func testCopy(apply fstest.Applier) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "failed to create temporary directory")
|
return errors.Wrap(err, "failed to create temporary directory")
|
||||||
}
|
}
|
||||||
|
defer os.RemoveAll(t1)
|
||||||
|
|
||||||
t2, err := ioutil.TempDir("", "test-copy-dst-")
|
t2, err := ioutil.TempDir("", "test-copy-dst-")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "failed to create temporary directory")
|
return errors.Wrap(err, "failed to create temporary directory")
|
||||||
}
|
}
|
||||||
|
defer os.RemoveAll(t2)
|
||||||
|
|
||||||
if err := apply.Apply(t1); err != nil {
|
if err := apply.Apply(t1); err != nil {
|
||||||
return errors.Wrap(err, "failed to apply changes")
|
return errors.Wrap(err, "failed to apply changes")
|
||||||
|
Loading…
Reference in New Issue
Block a user