aboutsummaryrefslogtreecommitdiff
path: root/libpod/lock/file/file_lock_test.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-05-06 04:58:25 -0400
committerGitHub <noreply@github.com>2022-05-06 04:58:25 -0400
commit5d5cb402cb6be818d6efd52d2198b00a55df0f1b (patch)
tree761cf9f6dbcff5aa0551737dd3c11b1aa4a20a6f /libpod/lock/file/file_lock_test.go
parent8ba679fc37fe62e7af31611e47b09a6c4b11f3a9 (diff)
parentd7f43e6772b734d0a7a7533bf94a61939ac1ebe5 (diff)
downloadpodman-5d5cb402cb6be818d6efd52d2198b00a55df0f1b.tar.gz
podman-5d5cb402cb6be818d6efd52d2198b00a55df0f1b.tar.bz2
podman-5d5cb402cb6be818d6efd52d2198b00a55df0f1b.zip
Merge pull request #14129 from Juneezee/test/t.TempDir
test: use `T.TempDir` to create temporary test directory
Diffstat (limited to 'libpod/lock/file/file_lock_test.go')
-rw-r--r--libpod/lock/file/file_lock_test.go11
1 files changed, 3 insertions, 8 deletions
diff --git a/libpod/lock/file/file_lock_test.go b/libpod/lock/file/file_lock_test.go
index 7ac8bf31a..2d7dded23 100644
--- a/libpod/lock/file/file_lock_test.go
+++ b/libpod/lock/file/file_lock_test.go
@@ -2,7 +2,6 @@ package file
import (
"fmt"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -13,11 +12,9 @@ import (
// Test that creating and destroying locks work
func TestCreateAndDeallocate(t *testing.T) {
- d, err := ioutil.TempDir("", "filelock")
- assert.NoError(t, err)
- defer os.RemoveAll(d)
+ d := t.TempDir()
- _, err = OpenFileLock(filepath.Join(d, "locks"))
+ _, err := OpenFileLock(filepath.Join(d, "locks"))
assert.Error(t, err)
l, err := CreateFileLock(filepath.Join(d, "locks"))
@@ -47,9 +44,7 @@ func TestCreateAndDeallocate(t *testing.T) {
// Test that creating and destroying locks work
func TestLockAndUnlock(t *testing.T) {
- d, err := ioutil.TempDir("", "filelock")
- assert.NoError(t, err)
- defer os.RemoveAll(d)
+ d := t.TempDir()
l, err := CreateFileLock(filepath.Join(d, "locks"))
assert.NoError(t, err)