Remove ioutil in kubelet and its tests
Signed-off-by: inosato <si17_21@yahoo.co.jp>
This commit is contained in:
@@ -19,7 +19,6 @@ package kubelet
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -182,11 +181,11 @@ fe00::2 ip6-allrouters
|
||||
// writeHostsFile will write a hosts file into a temporary dir, and return that dir.
|
||||
// Caller is responsible for deleting the dir and its contents.
|
||||
func writeHostsFile(filename string, cfg string) (string, error) {
|
||||
tmpdir, err := ioutil.TempDir("", "kubelet=kubelet_pods_test.go=")
|
||||
tmpdir, err := os.MkdirTemp("", "kubelet=kubelet_pods_test.go=")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return tmpdir, ioutil.WriteFile(filepath.Join(tmpdir, filename), []byte(cfg), 0644)
|
||||
return tmpdir, os.WriteFile(filepath.Join(tmpdir, filename), []byte(cfg), 0644)
|
||||
}
|
||||
|
||||
func TestManagedHostsFileContent(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user