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

@@ -21,7 +21,6 @@ package util
import (
"fmt"
"io/ioutil"
"math/rand"
"net"
"os"
@@ -204,7 +203,7 @@ func testPipe(t *testing.T, label string) {
}
func testRegularFile(t *testing.T, label string, exists bool) {
f, err := ioutil.TempFile("", "test-file")
f, err := os.CreateTemp("", "test-file")
require.NoErrorf(t, err, "Failed to create file for test purposes: %v while setting up: %s", err, label)
testFile := f.Name()
if !exists {
@@ -218,7 +217,7 @@ func testRegularFile(t *testing.T, label string, exists bool) {
}
func testUnixDomainSocket(t *testing.T, label string) {
f, err := ioutil.TempFile("", "test-domain-socket")
f, err := os.CreateTemp("", "test-domain-socket")
require.NoErrorf(t, err, "Failed to create file for test purposes: %v while setting up: %s", err, label)
testFile := f.Name()
f.Close()
@@ -241,7 +240,7 @@ func testPendingUnixDomainSocket(t *testing.T, label string) {
// not-yet-ready state. We need this because the Kubelet keeps an eye on file
// changes and acts on them, leading to potential race issues as described in
// the referenced issue above
f, err := ioutil.TempFile("", "test-domain-socket")
f, err := os.CreateTemp("", "test-domain-socket")
require.NoErrorf(t, err, "Failed to create file for test purposes: %v while setting up: %s", err, label)
testFile := f.Name()
f.Close()