diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-09-21 16:12:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-21 16:12:25 +0200 |
commit | 12655484e39eadbc0fa0607542aa4a49a21013a1 (patch) | |
tree | 9690fd321a567f302c0fc2d46854b00316af3957 /libpod/events/logfile_test.go | |
parent | a4399ef813840b48fc027edc3d0bdedf8a038f23 (diff) | |
parent | d968f3fe09a4c7d74464cfe2eaa9e4febbe61ba5 (diff) | |
download | podman-12655484e39eadbc0fa0607542aa4a49a21013a1.tar.gz podman-12655484e39eadbc0fa0607542aa4a49a21013a1.tar.bz2 podman-12655484e39eadbc0fa0607542aa4a49a21013a1.zip |
Merge pull request #15871 from cevich/replace_ioutil
Replace deprecated ioutil
Diffstat (limited to 'libpod/events/logfile_test.go')
-rw-r--r-- | libpod/events/logfile_test.go | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/libpod/events/logfile_test.go b/libpod/events/logfile_test.go index 302533c12..50141168e 100644 --- a/libpod/events/logfile_test.go +++ b/libpod/events/logfile_test.go @@ -1,7 +1,6 @@ package events import ( - "io/ioutil" "os" "testing" @@ -29,7 +28,7 @@ func TestRotateLog(t *testing.T) { } for _, test := range tests { - tmp, err := ioutil.TempFile("", "log-rotation-") + tmp, err := os.CreateTemp("", "log-rotation-") require.NoError(t, err) defer os.Remove(tmp.Name()) defer tmp.Close() @@ -84,7 +83,7 @@ func TestTruncationOutput(t *testing.T) { 10 ` // Create dummy file - tmp, err := ioutil.TempFile("", "log-rotation") + tmp, err := os.CreateTemp("", "log-rotation") require.NoError(t, err) defer os.Remove(tmp.Name()) defer tmp.Close() @@ -94,11 +93,11 @@ func TestTruncationOutput(t *testing.T) { require.NoError(t, err) // Truncate the file - beforeTruncation, err := ioutil.ReadFile(tmp.Name()) + beforeTruncation, err := os.ReadFile(tmp.Name()) require.NoError(t, err) err = truncate(tmp.Name()) require.NoError(t, err) - afterTruncation, err := ioutil.ReadFile(tmp.Name()) + afterTruncation, err := os.ReadFile(tmp.Name()) require.NoError(t, err) // Test if rotation was successful @@ -116,9 +115,9 @@ func TestRenameLog(t *testing.T) { 5 ` // Create two dummy files - source, err := ioutil.TempFile("", "removing") + source, err := os.CreateTemp("", "removing") require.NoError(t, err) - target, err := ioutil.TempFile("", "renaming") + target, err := os.CreateTemp("", "renaming") require.NoError(t, err) // Write to source dummy file @@ -126,11 +125,11 @@ func TestRenameLog(t *testing.T) { require.NoError(t, err) // Rename the files - beforeRename, err := ioutil.ReadFile(source.Name()) + beforeRename, err := os.ReadFile(source.Name()) require.NoError(t, err) err = renameLog(source.Name(), target.Name()) require.NoError(t, err) - afterRename, err := ioutil.ReadFile(target.Name()) + afterRename, err := os.ReadFile(target.Name()) require.NoError(t, err) // Test if renaming was successful |