github.com/containers/libpod@v1.9.4-0.20220419124438-4284fd425507/test/e2e/history_test.go (about) 1 package integration 2 3 import ( 4 "os" 5 6 . "github.com/containers/libpod/test/utils" 7 . "github.com/onsi/ginkgo" 8 . "github.com/onsi/gomega" 9 ) 10 11 var _ = Describe("Podman history", func() { 12 var ( 13 tempdir string 14 err error 15 podmanTest *PodmanTestIntegration 16 ) 17 18 BeforeEach(func() { 19 tempdir, err = CreateTempDirInTempDir() 20 if err != nil { 21 os.Exit(1) 22 } 23 podmanTest = PodmanTestCreate(tempdir) 24 podmanTest.Setup() 25 podmanTest.SeedImages() 26 }) 27 28 AfterEach(func() { 29 podmanTest.Cleanup() 30 f := CurrentGinkgoTestDescription() 31 processTestResult(f) 32 33 }) 34 35 It("podman history output flag", func() { 36 session := podmanTest.Podman([]string{"history", ALPINE}) 37 session.WaitWithDefaultTimeout() 38 Expect(session.ExitCode()).To(Equal(0)) 39 Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 0)) 40 }) 41 42 It("podman history with GO template", func() { 43 session := podmanTest.Podman([]string{"history", "--format", "{{.ID}} {{.Created}}", ALPINE}) 44 session.WaitWithDefaultTimeout() 45 Expect(session.ExitCode()).To(Equal(0)) 46 Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 0)) 47 }) 48 49 It("podman history with human flag", func() { 50 session := podmanTest.Podman([]string{"history", "--human=false", ALPINE}) 51 session.WaitWithDefaultTimeout() 52 Expect(session.ExitCode()).To(Equal(0)) 53 Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 0)) 54 }) 55 56 It("podman history with quiet flag", func() { 57 session := podmanTest.Podman([]string{"history", "-qH", ALPINE}) 58 session.WaitWithDefaultTimeout() 59 Expect(session.ExitCode()).To(Equal(0)) 60 Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 0)) 61 }) 62 63 It("podman history with no-trunc flag", func() { 64 session := podmanTest.Podman([]string{"history", "--no-trunc", ALPINE}) 65 session.WaitWithDefaultTimeout() 66 Expect(session.ExitCode()).To(Equal(0)) 67 Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 0)) 68 }) 69 70 It("podman history with json flag", func() { 71 session := podmanTest.Podman([]string{"history", "--format=json", ALPINE}) 72 session.WaitWithDefaultTimeout() 73 Expect(session.ExitCode()).To(Equal(0)) 74 Expect(session.IsJSONOutputValid()).To(BeTrue()) 75 }) 76 })