mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00
test/e2e: fix incorrect usage of CreateTempDirInTempDir()
Creating a new diretory results in the test leaking it when it is not removed via a defer call. All tests have already access to `podmanTest.TempDir` which will be automatically removed in the `AfterEach()` block. While some test were fine other forgot the defer call. To keep the test consitent and prevent other from making the same mistake convert all users to `podmanTest.TempDir`. `CreateTempDirInTempDir()` is only used for the `podmanTest.Setup()` call. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@ -3,6 +3,7 @@ package integration
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
. "github.com/containers/podman/v4/test/utils"
|
||||
. "github.com/onsi/ginkgo"
|
||||
@ -47,7 +48,8 @@ var _ = Describe("Podman run", func() {
|
||||
})
|
||||
|
||||
It("podman run a container using a --workdir under a bind mount", func() {
|
||||
volume, err := CreateTempDirInTempDir()
|
||||
volume := filepath.Join(podmanTest.TempDir, "vol")
|
||||
err = os.MkdirAll(volume, os.ModePerm)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"run", "--volume", fmt.Sprintf("%s:/var_ovl/:O", volume), "--workdir", "/var_ovl/log", ALPINE, "true"})
|
||||
|
Reference in New Issue
Block a user