summaryrefslogtreecommitdiff
path: root/pkg/machine
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 /pkg/machine
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 'pkg/machine')
-rw-r--r--pkg/machine/qemu/config_test.go14
1 files changed, 3 insertions, 11 deletions
diff --git a/pkg/machine/qemu/config_test.go b/pkg/machine/qemu/config_test.go
index 3f92881fa..4d96ec6e7 100644
--- a/pkg/machine/qemu/config_test.go
+++ b/pkg/machine/qemu/config_test.go
@@ -52,23 +52,15 @@ func TestMachineFile_GetPath(t *testing.T) {
func TestNewMachineFile(t *testing.T) {
empty := ""
- homedir, err := os.MkdirTemp("/tmp", "homedir")
- if err != nil {
- panic(err)
- }
- defer os.RemoveAll(homedir)
- longTemp, err := os.MkdirTemp("/tmp", "tmpdir")
- if err != nil {
- panic(err)
- }
- defer os.RemoveAll(longTemp)
+ homedir := t.TempDir()
+ longTemp := t.TempDir()
oldhome := os.Getenv("HOME")
os.Setenv("HOME", homedir) //nolint: tenv
defer os.Setenv("HOME", oldhome)
p := "/var/tmp/podman/my.sock"
longp := filepath.Join(longTemp, utils.RandomString(100), "my.sock")
- err = os.MkdirAll(filepath.Dir(longp), 0755)
+ err := os.MkdirAll(filepath.Dir(longp), 0755)
if err != nil {
panic(err)
}