github.com/containers/podman/v2@v2.2.2-0.20210501105131-c1e07d070c4c/test/e2e/run_restart_test.go (about) 1 package integration 2 3 import ( 4 "os" 5 6 . "github.com/containers/podman/v2/test/utils" 7 . "github.com/onsi/ginkgo" 8 . "github.com/onsi/gomega" 9 ) 10 11 var _ = Describe("Podman run restart containers", 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 start after successful run", func() { 36 session := podmanTest.Podman([]string{"run", "--name", "test", ALPINE, "ls"}) 37 session.WaitWithDefaultTimeout() 38 Expect(session.ExitCode()).To(Equal(0)) 39 40 session = podmanTest.Podman([]string{"wait", "test"}) 41 session.WaitWithDefaultTimeout() 42 Expect(session.ExitCode()).To(Equal(0)) 43 44 session2 := podmanTest.Podman([]string{"start", "--attach", "test"}) 45 session2.WaitWithDefaultTimeout() 46 Expect(session2.ExitCode()).To(Equal(0)) 47 }) 48 49 It("Podman start after signal kill", func() { 50 _ = podmanTest.RunTopContainer("test1") 51 ok := WaitForContainer(podmanTest) 52 Expect(ok).To(BeTrue()) 53 54 killSession := podmanTest.Podman([]string{"kill", "-s", "9", "test1"}) 55 killSession.WaitWithDefaultTimeout() 56 Expect(killSession.ExitCode()).To(Equal(0)) 57 58 session2 := podmanTest.Podman([]string{"start", "test1"}) 59 session2.WaitWithDefaultTimeout() 60 Expect(session2.ExitCode()).To(Equal(0)) 61 }) 62 })