mirror of
https://github.com/containers/podman.git
synced 2025-07-01 00:01:02 +08:00
test/e2e: podman unshare image mount fix tmpdir leak
Because the test left the image mounted the cleanup failed to remove the tmpdir as it contained an active mount point. Thus ensure we unmount the image again to prevent this leak. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
"slices"
|
||||
|
||||
. "github.com/containers/podman/v5/test/utils"
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
@ -63,5 +65,14 @@ var _ = Describe("Podman mount", func() {
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session.OutputToString()).To(ContainSubstring(podmanTest.TempDir))
|
||||
|
||||
// We have to unmount the image again otherwise we leak the tmpdir
|
||||
// as active mount points cannot be removed.
|
||||
index := slices.Index(args, "mount")
|
||||
Expect(index).To(BeNumerically(">", 0), "index should be found")
|
||||
args[index] = "unmount"
|
||||
session = podmanTest.Podman(args)
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user