diff options
author | Peter Hunt <pehunt@redhat.com> | 2019-09-16 12:37:16 -0400 |
---|---|---|
committer | Peter Hunt <pehunt@redhat.com> | 2019-09-16 15:27:00 -0400 |
commit | 5f97721afc1a1167ec3981bc3caac9be4fdae2ae (patch) | |
tree | ef0e834dc81b3e6ce994c8bcd3c066fc119ad104 /test/e2e/exec_test.go | |
parent | 1f5514ea551b12041346763a951bbe4a2f5fc3c3 (diff) | |
download | podman-5f97721afc1a1167ec3981bc3caac9be4fdae2ae.tar.gz podman-5f97721afc1a1167ec3981bc3caac9be4fdae2ae.tar.bz2 podman-5f97721afc1a1167ec3981bc3caac9be4fdae2ae.zip |
exec: fix --preserve-fds
There were two problems with preserve fds.
libpod didn't open the fds before passing _OCI*PIPE to conmon. This caused libpod to talk on the preserved fds, rather than the pipes, with conmon talking on the pipes. This caused a hang.
Libpod also didn't convert an int to string correctly, so it would further fail.
Fix these and add a unit test to make sure we don't regress in the future
Note: this test will not pass on crun until crun supports --preserve-fds
Signed-off-by: Peter Hunt <pehunt@redhat.com>
Diffstat (limited to 'test/e2e/exec_test.go')
-rw-r--r-- | test/e2e/exec_test.go | 15 |
1 files changed, 15 insertions, 0 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)) + }) }) |