Remove ioutil in kubelet and its tests

Signed-off-by: inosato <si17_21@yahoo.co.jp>
This commit is contained in:
inosato
2022-07-18 23:51:51 +09:00
parent f6e163fe27
commit 3b95d3b076
40 changed files with 222 additions and 253 deletions

View File

@@ -18,7 +18,7 @@ package kubelet
import (
"bytes"
"io/ioutil"
"io"
"os"
"path/filepath"
"testing"
@@ -84,17 +84,17 @@ func TestApplyKubeletConfigPatches(t *testing.T) {
expectedOutput = []byte("bar: 1\nfoo: 0\n")
)
dir, err := ioutil.TempDir("", "patches")
dir, err := os.MkdirTemp("", "patches")
if err != nil {
t.Fatalf("could not create temp dir: %v", err)
}
defer os.RemoveAll(dir)
if err := ioutil.WriteFile(filepath.Join(dir, "kubeletconfiguration.yaml"), patch, 0644); err != nil {
if err := os.WriteFile(filepath.Join(dir, "kubeletconfiguration.yaml"), patch, 0644); err != nil {
t.Fatalf("could not write patch file: %v", err)
}
output, err := applyKubeletConfigPatches(input, dir, ioutil.Discard)
output, err := applyKubeletConfigPatches(input, dir, io.Discard)
if err != nil {
t.Fatalf("could not apply patch: %v", err)
}