From d467b29c5cbe882c38e255c0f09c741ab8a80de9 Mon Sep 17 00:00:00 2001 From: yue9944882 <291271447@qq.com> Date: Fri, 8 Jun 2018 14:28:19 +0800 Subject: [PATCH] remove duplicated cleaning up func --- pkg/kubelet/config/file_linux_test.go | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/pkg/kubelet/config/file_linux_test.go b/pkg/kubelet/config/file_linux_test.go index e747bef7189..b449b8aafa9 100644 --- a/pkg/kubelet/config/file_linux_test.go +++ b/pkg/kubelet/config/file_linux_test.go @@ -321,10 +321,6 @@ func watchFileChanged(watchDir bool, symlink bool, t *testing.T) { if watchDir { NewSourceFile(dirName, hostname, 100*time.Millisecond, ch) - defer func() { - // Remove the file - deleteFile(dirName, fileName, ch, t) - }() } else { NewSourceFile(file, hostname, 100*time.Millisecond, ch) } @@ -363,22 +359,6 @@ func watchFileChanged(watchDir bool, symlink bool, t *testing.T) { } } -func deleteFile(dir, file string, ch chan interface{}, t *testing.T) { - path := filepath.Join(dir, file) - if _, err := os.Stat(path); err != nil { - // The file might absent if it's renamed, deleted.. - return - } - go func() { - err := os.Remove(path) - if err != nil { - t.Errorf("unable to remove test file %s: %s", path, err) - } - }() - - expectEmptyUpdate(t, ch) -} - func expectUpdate(t *testing.T, ch chan interface{}, testCase *testCase) { timer := time.After(5 * time.Second) for {