refactor: move from io/ioutil to io and os package
The io/ioutil package has been deprecated as of Go 1.16, see https://golang.org/doc/go1.16#ioutil. This commit replaces the existing io/ioutil functions with their new definitions in io and os packages. Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
goruntime "runtime"
|
||||
@@ -65,7 +64,7 @@ func TestPodHostname(t *testing.T) {
|
||||
if test.needsHostNetwork && goruntime.GOOS == "windows" {
|
||||
t.Skip("Skipped on Windows.")
|
||||
}
|
||||
testPodLogDir, err := ioutil.TempDir("/tmp", "hostname")
|
||||
testPodLogDir, err := os.MkdirTemp("/tmp", "hostname")
|
||||
require.NoError(t, err)
|
||||
defer os.RemoveAll(testPodLogDir)
|
||||
|
||||
@@ -121,7 +120,7 @@ func TestPodHostname(t *testing.T) {
|
||||
return false, nil
|
||||
}, time.Second, 30*time.Second))
|
||||
|
||||
content, err := ioutil.ReadFile(filepath.Join(testPodLogDir, containerName))
|
||||
content, err := os.ReadFile(filepath.Join(testPodLogDir, containerName))
|
||||
assert.NoError(t, err)
|
||||
|
||||
t.Log("Search hostname env in container log")
|
||||
|
||||
Reference in New Issue
Block a user