summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorQi Wang <qiwan@redhat.com>2019-05-23 14:30:02 -0400
committerQi Wang <qiwan@redhat.com>2019-05-24 11:51:30 -0400
commitbb7b0aad0eb7874c97911d8a27532100f1a32232 (patch)
treed7e960c1310076ddfa99ab77f7cfe941b02d87bc /test
parent579fd01f7df929373a6b68a4c4dda17084832db4 (diff)
downloadpodman-bb7b0aad0eb7874c97911d8a27532100f1a32232.tar.gz
podman-bb7b0aad0eb7874c97911d8a27532100f1a32232.tar.bz2
podman-bb7b0aad0eb7874c97911d8a27532100f1a32232.zip
fix bug dest path of copying tar
when podman cp tar without --extract flag, if the destination already exists, or ends with path seprator, cp the tar under the directory, otherwise copy the tar named with the destination Signed-off-by: Qi Wang <qiwan@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/e2e/cp_test.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/e2e/cp_test.go b/test/e2e/cp_test.go
index 1dfa8f50d..16e03472e 100644
--- a/test/e2e/cp_test.go
+++ b/test/e2e/cp_test.go
@@ -143,4 +143,31 @@ var _ = Describe("Podman cp", func() {
os.Remove("file.tar.gz")
os.RemoveAll(testDirPath)
})
+
+ It("podman cp tar", func() {
+ path, err := os.Getwd()
+ Expect(err).To(BeNil())
+ testDirPath := filepath.Join(path, "TestDir")
+ err = os.Mkdir(testDirPath, 0777)
+ Expect(err).To(BeNil())
+ cmd := exec.Command("tar", "-cvf", "file.tar", testDirPath)
+ _, err = cmd.Output()
+ Expect(err).To(BeNil())
+
+ session := podmanTest.Podman([]string{"create", "--name", "testctr", ALPINE, "ls", "-l", "foo"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"cp", "file.tar", "testctr:/foo/"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"start", "-a", "testctr"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring("file.tar"))
+
+ os.Remove("file.tar")
+ os.RemoveAll(testDirPath)
+ })
})