github.com/containers/libpod@v1.9.4-0.20220419124438-4284fd425507/test/e2e/run_restart_test.go (about) 1 // +build !remoteclient 2 3 package integration 4 5 import ( 6 "os" 7 8 . "github.com/containers/libpod/test/utils" 9 . "github.com/onsi/ginkgo" 10 . "github.com/onsi/gomega" 11 ) 12 13 var _ = Describe("Podman run restart containers", func() { 14 var ( 15 tempdir string 16 err error 17 podmanTest *PodmanTestIntegration 18 ) 19 20 BeforeEach(func() { 21 tempdir, err = CreateTempDirInTempDir() 22 if err != nil { 23 os.Exit(1) 24 } 25 podmanTest = PodmanTestCreate(tempdir) 26 podmanTest.Setup() 27 podmanTest.SeedImages() 28 }) 29 30 AfterEach(func() { 31 podmanTest.Cleanup() 32 f := CurrentGinkgoTestDescription() 33 processTestResult(f) 34 35 }) 36 37 It("Podman start after successful run", func() { 38 session := podmanTest.Podman([]string{"run", ALPINE, "ls"}) 39 session.WaitWithDefaultTimeout() 40 Expect(session.ExitCode()).To(Equal(0)) 41 42 session2 := podmanTest.Podman([]string{"start", "--attach", "--latest"}) 43 session2.WaitWithDefaultTimeout() 44 Expect(session2.ExitCode()).To(Equal(0)) 45 }) 46 47 It("Podman start after signal kill", func() { 48 _ = podmanTest.RunTopContainer("test1") 49 ok := WaitForContainer(podmanTest) 50 Expect(ok).To(BeTrue()) 51 52 killSession := podmanTest.Podman([]string{"kill", "-s", "9", "test1"}) 53 killSession.WaitWithDefaultTimeout() 54 Expect(killSession.ExitCode()).To(Equal(0)) 55 56 session2 := podmanTest.Podman([]string{"start", "test1"}) 57 session2.WaitWithDefaultTimeout() 58 Expect(session2.ExitCode()).To(Equal(0)) 59 }) 60 })