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
Li Zhijian 2020-08-19 16:54:17 +08:00
parent 348b8c9865
commit 640e9b64f8
1 changed files with 2 additions and 2 deletions

View File

@ -33,12 +33,12 @@ func TestReplaceWinDriveLetterToVolumeName(t *testing.T) {
if err != nil {
t.Fatalf("Error make tmp directory: %v", err)
}
defer func() { //clean up tempdir
defer func(path string) { //clean up tempdir
err := os.RemoveAll(path)
if err != nil {
t.Errorf("failed to clean up temp folder %q", path)
}
}()
}(path)
if runtime.GOOS != "windows" {
// Replace to fake func.