Skip to content

Commit

Permalink
FIXUP! try unix.Unmount instead
Browse files Browse the repository at this point in the history
Signed-off-by: Ed Santiago <santiago@redhat.com>
  • Loading branch information
edsantiago committed Nov 6, 2023
1 parent e566c9d commit 254b9e5
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions test/e2e/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
"github.com/sirupsen/logrus"
"golang.org/x/sys/unix"
)

var (
Expand Down Expand Up @@ -983,16 +984,15 @@ func populateCache(podman *PodmanTestIntegration) {
// rmAll removes the directory and its content, when running rootless we use
// podman unshare to prevent any subuid/gid problems
func rmAll(podmanBin string, path string) {
// When using overlay, podman leaves a stray mount behind. This
// leak causes remote tests to take a loooooong time, which then
// causes Cirrus to time out. Unmount the stray.
overlayPath := path + "/root/overlay"
if _, err := os.Stat(overlayPath); err == nil {
umount := exec.Command("umount", overlayPath)
umount.Stdout = GinkgoWriter
umount.Stderr = GinkgoWriter
if err = umount.Run(); err != nil {
GinkgoWriter.Printf("Error umounting %s: %v\n", overlayPath, err)
// When using overlay as root, podman leaves a stray mount behind. This
// leak causes remote tests to take a loooooong time, which then causes
// Cirrus to time out. Unmount the stray.
if os.Geteuid() == 0 {
overlayPath := path + "/root/overlay"
if _, err := os.Stat(overlayPath); err == nil {
if err = unix.Unmount(overlayPath, unix.MNT_DETACH); err != nil {
GinkgoWriter.Printf("Error unmounting %s: %v\n", overlayPath, err)
}
}
}

Expand Down

0 comments on commit 254b9e5

Please sign in to comment.