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:
Paul Holzinger 2024-04-26 18:16:27 +02:00
parent 0faded53b8
commit 88b80c1df6
No known key found for this signature in database
GPG Key ID: EB145DD938A3CAF2
1 changed files with 11 additions and 0 deletions

View File

@ -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())
})
})