瀏覽代碼

Added missing test cleanup for temporary directory

A temporary directory was created but not removed at the end of the test.
The missing remove directory call is added now.

Signed-off-by: Muhammad Zohaib Aslam <zohaibse011@gmail.com>
Muhammad Zohaib Aslam 4 年之前
父節點
當前提交
56c88c94dd
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      daemon/graphdriver/copy/copy_test.go

+ 2 - 1
daemon/graphdriver/copy/copy_test.go

@@ -33,6 +33,7 @@ func TestCopyWithoutRange(t *testing.T) {
 func TestCopyDir(t *testing.T) {
 func TestCopyDir(t *testing.T) {
 	srcDir, err := ioutil.TempDir("", "srcDir")
 	srcDir, err := ioutil.TempDir("", "srcDir")
 	assert.NilError(t, err)
 	assert.NilError(t, err)
+	defer os.RemoveAll(srcDir)
 	populateSrcDir(t, srcDir, 3)
 	populateSrcDir(t, srcDir, 3)
 
 
 	dstDir, err := ioutil.TempDir("", "testdst")
 	dstDir, err := ioutil.TempDir("", "testdst")
@@ -111,7 +112,7 @@ func doCopyTest(t *testing.T, copyWithFileRange, copyWithFileClone *bool) {
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 	defer os.RemoveAll(dir)
 	defer os.RemoveAll(dir)
 	srcFilename := filepath.Join(dir, "srcFilename")
 	srcFilename := filepath.Join(dir, "srcFilename")
-	dstFilename := filepath.Join(dir, "dstilename")
+	dstFilename := filepath.Join(dir, "dstFilename")
 
 
 	r := rand.New(rand.NewSource(0))
 	r := rand.New(rand.NewSource(0))
 	buf := make([]byte, 1024)
 	buf := make([]byte, 1024)