github.com/containers/podman/v4@v4.9.4/test/e2e/export_test.go (about) 1 package integration 2 3 import ( 4 "os" 5 "path/filepath" 6 7 . "github.com/containers/podman/v4/test/utils" 8 . "github.com/onsi/ginkgo/v2" 9 . "github.com/onsi/gomega" 10 ) 11 12 var _ = Describe("Podman export", func() { 13 14 It("podman export output flag", func() { 15 _, ec, cid := podmanTest.RunLsContainer("") 16 Expect(ec).To(Equal(0)) 17 18 outfile := filepath.Join(podmanTest.TempDir, "container.tar") 19 result := podmanTest.Podman([]string{"export", "-o", outfile, cid}) 20 result.WaitWithDefaultTimeout() 21 Expect(result).Should(ExitCleanly()) 22 _, err := os.Stat(outfile) 23 Expect(err).ToNot(HaveOccurred()) 24 25 err = os.Remove(outfile) 26 Expect(err).ToNot(HaveOccurred()) 27 }) 28 29 It("podman container export output flag", func() { 30 _, ec, cid := podmanTest.RunLsContainer("") 31 Expect(ec).To(Equal(0)) 32 33 outfile := filepath.Join(podmanTest.TempDir, "container.tar") 34 result := podmanTest.Podman([]string{"container", "export", "-o", outfile, cid}) 35 result.WaitWithDefaultTimeout() 36 Expect(result).Should(ExitCleanly()) 37 _, err := os.Stat(outfile) 38 Expect(err).ToNot(HaveOccurred()) 39 40 err = os.Remove(outfile) 41 Expect(err).ToNot(HaveOccurred()) 42 }) 43 44 It("podman export bad filename", func() { 45 _, ec, cid := podmanTest.RunLsContainer("") 46 Expect(ec).To(Equal(0)) 47 48 outfile := filepath.Join(podmanTest.TempDir, "container:with:colon.tar") 49 result := podmanTest.Podman([]string{"export", "-o", outfile, cid}) 50 result.WaitWithDefaultTimeout() 51 Expect(result).To(ExitWithError()) 52 }) 53 })