summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAditya Rajan <arajan@redhat.com>2021-10-18 15:47:55 +0530
committerAditya Rajan <arajan@redhat.com>2021-10-18 19:01:55 +0530
commitd0f7b99c6dfb8dcbdc4a36e765cc8eb7fcde4798 (patch)
tree30452575f0500c8370ce6a5ed16f845d7f9a36e4 /test
parent0144f46ac5067196019225430847691502d74da7 (diff)
downloadpodman-d0f7b99c6dfb8dcbdc4a36e765cc8eb7fcde4798.tar.gz
podman-d0f7b99c6dfb8dcbdc4a36e765cc8eb7fcde4798.tar.bz2
podman-d0f7b99c6dfb8dcbdc4a36e765cc8eb7fcde4798.zip
rootfs-overlay: fix overlaybase path for cleanups
Following commit ensures not dandling mounts are left behind when we are creating an overlay on top of external rootfs. Co-authored-by: Valentin Rothberg <rothberg@redhat.com> Signed-off-by: Aditya Rajan <arajan@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/e2e/run_test.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go
index b6743f4b7..f40d4a749 100644
--- a/test/e2e/run_test.go
+++ b/test/e2e/run_test.go
@@ -5,6 +5,7 @@ import (
"io/ioutil"
"net"
"os"
+ "os/exec"
"path/filepath"
"strconv"
"strings"
@@ -12,6 +13,7 @@ import (
"time"
"github.com/containers/podman/v3/pkg/cgroups"
+ "github.com/containers/podman/v3/pkg/rootless"
. "github.com/containers/podman/v3/test/utils"
"github.com/containers/storage/pkg/stringid"
"github.com/mrunalp/fileutils"
@@ -226,6 +228,37 @@ var _ = Describe("Podman run", func() {
stdoutLines := session.OutputToStringArray()
Expect(stdoutLines).Should(HaveLen(1))
Expect(stdoutLines[0]).Should(Equal(uniqueString))
+
+ SkipIfRemote("External overlay only work locally")
+ if os.Getenv("container") != "" {
+ Skip("Overlay mounts not supported when running in a container")
+ }
+ if rootless.IsRootless() {
+ if _, err := exec.LookPath("fuse-overlayfs"); err != nil {
+ Skip("Fuse-Overlayfs required for rootless overlay mount test")
+ }
+ }
+ // Test --rootfs with an external overlay
+ // use --rm to remove container and confirm if we did not leak anything
+ osession := podmanTest.Podman([]string{"run", "-i", "--rm", "--security-opt", "label=disable",
+ "--rootfs", rootfs + ":O", "cat", testFilePath})
+ osession.WaitWithDefaultTimeout()
+ Expect(osession).Should(Exit(0))
+
+ // Test podman start stop with overlay
+ osession = podmanTest.Podman([]string{"run", "--name", "overlay-foo", "--security-opt", "label=disable",
+ "--rootfs", rootfs + ":O", "echo", "hello"})
+ osession.WaitWithDefaultTimeout()
+ Expect(osession).Should(Exit(0))
+
+ osession = podmanTest.Podman([]string{"stop", "overlay-foo"})
+ osession.WaitWithDefaultTimeout()
+ Expect(osession).Should(Exit(0))
+
+ startsession := podmanTest.Podman([]string{"start", "--attach", "overlay-foo"})
+ startsession.WaitWithDefaultTimeout()
+ Expect(startsession).Should(Exit(0))
+ Expect(startsession.OutputToString()).To(Equal("hello"))
})
It("podman run a container with --init", func() {