cleanup tempdir properly for localpath_test
'path' could be changed during the test Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>pull/9032/head
parent
348b8c9865
commit
640e9b64f8
|
@ -33,12 +33,12 @@ func TestReplaceWinDriveLetterToVolumeName(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Error make tmp directory: %v", err)
|
t.Fatalf("Error make tmp directory: %v", err)
|
||||||
}
|
}
|
||||||
defer func() { //clean up tempdir
|
defer func(path string) { //clean up tempdir
|
||||||
err := os.RemoveAll(path)
|
err := os.RemoveAll(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("failed to clean up temp folder %q", path)
|
t.Errorf("failed to clean up temp folder %q", path)
|
||||||
}
|
}
|
||||||
}()
|
}(path)
|
||||||
|
|
||||||
if runtime.GOOS != "windows" {
|
if runtime.GOOS != "windows" {
|
||||||
// Replace to fake func.
|
// Replace to fake func.
|
||||||
|
|
Loading…
Reference in New Issue