diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/e2e/exec_test.go | 15 | ||||
-rw-r--r-- | test/e2e/run_cleanup_test.go | 16 |
2 files changed, 26 insertions, 5 deletions
diff --git a/test/e2e/exec_test.go b/test/e2e/exec_test.go index 670269eab..13fdabb81 100644 --- a/test/e2e/exec_test.go +++ b/test/e2e/exec_test.go @@ -2,6 +2,7 @@ package integration import ( "os" + "strings" . "github.com/containers/libpod/test/utils" . "github.com/onsi/ginkgo" @@ -228,4 +229,18 @@ var _ = Describe("Podman exec", func() { session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(127)) }) + + It("podman exec preserve fds sanity check", func() { + // TODO: add this test once crun adds the --preserve-fds flag for exec + if strings.Contains(podmanTest.OCIRuntime, "crun") { + Skip("Test only works on crun") + } + setup := podmanTest.RunTopContainer("test1") + setup.WaitWithDefaultTimeout() + Expect(setup.ExitCode()).To(Equal(0)) + + session := podmanTest.Podman([]string{"exec", "--preserve-fds", "1", "test1", "ls"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + }) }) diff --git a/test/e2e/run_cleanup_test.go b/test/e2e/run_cleanup_test.go index 86790e726..99d0d55e5 100644 --- a/test/e2e/run_cleanup_test.go +++ b/test/e2e/run_cleanup_test.go @@ -4,7 +4,6 @@ package integration import ( "os" - "strings" . "github.com/containers/libpod/test/utils" . "github.com/onsi/ginkgo" @@ -36,6 +35,8 @@ var _ = Describe("Podman run exit", func() { }) It("podman run -d mount cleanup test", func() { + SkipIfRootless() + result := podmanTest.Podman([]string{"run", "-dt", ALPINE, "top"}) result.WaitWithDefaultTimeout() cid := result.OutputToString() @@ -43,25 +44,30 @@ var _ = Describe("Podman run exit", func() { mount := SystemExec("mount", nil) Expect(mount.ExitCode()).To(Equal(0)) - Expect(strings.Contains(mount.OutputToString(), cid)) + Expect(mount.OutputToString()).To(ContainSubstring(cid)) pmount := podmanTest.Podman([]string{"mount", "--notruncate"}) pmount.WaitWithDefaultTimeout() - Expect(strings.Contains(pmount.OutputToString(), cid)) Expect(pmount.ExitCode()).To(Equal(0)) + Expect(pmount.OutputToString()).To(ContainSubstring(cid)) stop := podmanTest.Podman([]string{"stop", cid}) stop.WaitWithDefaultTimeout() Expect(stop.ExitCode()).To(Equal(0)) + // We have to force cleanup so the unmount happens + podmanCleanupSession := podmanTest.Podman([]string{"container", "cleanup", cid}) + podmanCleanupSession.WaitWithDefaultTimeout() + Expect(podmanCleanupSession.ExitCode()).To(Equal(0)) + mount = SystemExec("mount", nil) Expect(mount.ExitCode()).To(Equal(0)) - Expect(!strings.Contains(mount.OutputToString(), cid)) + Expect(mount.OutputToString()).NotTo(ContainSubstring(cid)) pmount = podmanTest.Podman([]string{"mount", "--notruncate"}) pmount.WaitWithDefaultTimeout() - Expect(!strings.Contains(pmount.OutputToString(), cid)) Expect(pmount.ExitCode()).To(Equal(0)) + Expect(pmount.OutputToString()).NotTo(ContainSubstring(cid)) }) }) |