From 4a95ef4a4e88e1563a89e2384b1545c361a46d26 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Wed, 22 Aug 2018 17:45:44 +0200 Subject: test: ad more tests for rootless containers Signed-off-by: Giuseppe Scrivano Closes: #1323 Approved by: umohnani8 --- test/e2e/rootless_test.go | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'test/e2e') diff --git a/test/e2e/rootless_test.go b/test/e2e/rootless_test.go index 9737b9a09..f77ad9924 100644 --- a/test/e2e/rootless_test.go +++ b/test/e2e/rootless_test.go @@ -44,7 +44,7 @@ var _ = Describe("Podman rootless", func() { } }) - It("podman rootless rootfs", func() { + runRootless := func(args []string) { // Check if we can create an user namespace err := exec.Command("unshare", "-r", "echo", "hello").Run() if err != nil { @@ -96,7 +96,9 @@ var _ = Describe("Podman rootless", func() { env = append(env, fmt.Sprintf("XDG_RUNTIME_DIR=%s", xdgRuntimeDir)) env = append(env, fmt.Sprintf("HOME=%s", home)) env = append(env, "PODMAN_ALLOW_SINGLE_ID_MAPPING_IN_USERNS=1") - cmd := podmanTest.PodmanAsUser([]string{"run", "--rootfs", mountPath, "echo", "hello"}, 1000, 1000, env) + allArgs := append([]string{"run"}, args...) + allArgs = append(allArgs, "--rootfs", mountPath, "echo", "hello") + cmd := podmanTest.PodmanAsUser(allArgs, 1000, 1000, env) cmd.WaitWithDefaultTimeout() Expect(cmd.LineInOutputContains("hello")).To(BeTrue()) Expect(cmd.ExitCode()).To(Equal(0)) @@ -107,5 +109,21 @@ var _ = Describe("Podman rootless", func() { umount := podmanTest.Podman([]string{"umount", cid}) umount.WaitWithDefaultTimeout() Expect(umount.ExitCode()).To(Equal(0)) + } + + It("podman rootless rootfs", func() { + runRootless([]string{}) + }) + + It("podman rootless rootfs --net host", func() { + runRootless([]string{"--net", "host"}) + }) + + It("podman rootless rootfs --privileged", func() { + runRootless([]string{"--privileged"}) + }) + + It("podman rootless rootfs --net host --privileged", func() { + runRootless([]string{"--net", "host", "--privileged"}) }) }) -- cgit v1.2.3-54-g00ecf