diff --git a/test/e2e/mount_rootless_test.go b/test/e2e/mount_rootless_test.go index 7b2a5badfa..7e4af2eb68 100644 --- a/test/e2e/mount_rootless_test.go +++ b/test/e2e/mount_rootless_test.go @@ -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()) }) })