mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-01 18:58:18 +00:00
test: using ioutil.TempDir in unit tests per #15176
update update mode delete /tmp update use ioutil.TempDir instead of static tmp dir use ioutil.TempDir instead of static tmp dir
This commit is contained in:
@@ -17,6 +17,8 @@ limitations under the License.
|
||||
package kubelet
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -36,9 +38,13 @@ func TestRunOnce(t *testing.T) {
|
||||
podManager := kubepod.NewBasicPodManager(kubepod.NewFakeMirrorClient())
|
||||
diskSpaceManager, _ := newDiskSpaceManager(cadvisor, DiskSpacePolicy{})
|
||||
fakeRuntime := &kubecontainer.FakeRuntime{}
|
||||
|
||||
basePath, err := ioutil.TempDir(os.TempDir(), "kubelet")
|
||||
if err != nil {
|
||||
t.Fatalf("can't make a temp rootdir %v", err)
|
||||
}
|
||||
defer os.RemoveAll(basePath)
|
||||
kb := &Kubelet{
|
||||
rootDirectory: "/tmp/kubelet",
|
||||
rootDirectory: basePath,
|
||||
recorder: &record.FakeRecorder{},
|
||||
cadvisor: cadvisor,
|
||||
nodeLister: testNodeLister{},
|
||||
|
||||
Reference in New Issue
Block a user