From b6e1689ff23777b91fdfe72823a9a4e10360c6c0 Mon Sep 17 00:00:00 2001 From: Qi Wang Date: Thu, 2 Jan 2020 00:52:51 -0500 Subject: fix bug copy from container directory Keep the original input source path with "/." so podman can copy the content of the directory when copying from container to host. Signed-off-by: Qi Wang --- test/e2e/cp_test.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'test/e2e') diff --git a/test/e2e/cp_test.go b/test/e2e/cp_test.go index 8d4c3dee7..b71897cfd 100644 --- a/test/e2e/cp_test.go +++ b/test/e2e/cp_test.go @@ -112,6 +112,33 @@ var _ = Describe("Podman cp", func() { session = podmanTest.Podman([]string{"cp", testDirPath, name + ":/foodir"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) + + testctr := "testctr" + setup := podmanTest.RunTopContainer(testctr) + setup.WaitWithDefaultTimeout() + Expect(setup.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"exec", testctr, "mkdir", "foo"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"cp", testDirPath + "/.", testctr + ":/foo"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + session = podmanTest.Podman([]string{"exec", testctr, "ls", "foo"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(len(session.OutputToString())).To(Equal(0)) + + session = podmanTest.Podman([]string{"cp", testctr + ":/foo/.", testDirPath}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + cmd := exec.Command("ls", testDirPath) + res, err := cmd.Output() + Expect(err).To(BeNil()) + Expect(len(res)).To(Equal(0)) + + os.RemoveAll(testDirPath) }) It("podman cp stdin/stdout", func() { -- cgit v1.2.3-54-g00ecf