github.com/hanks177/podman/v4@v4.1.3-0.20220613032544-16d90015bc83/test/e2e/run_restart_test.go (about)

     1  package integration
     2  
     3  import (
     4  	"os"
     5  
     6  	. "github.com/hanks177/podman/v4/test/utils"
     7  	. "github.com/onsi/ginkgo"
     8  	. "github.com/onsi/gomega"
     9  	. "github.com/onsi/gomega/gexec"
    10  )
    11  
    12  var _ = Describe("Podman run restart containers", func() {
    13  	var (
    14  		tempdir    string
    15  		err        error
    16  		podmanTest *PodmanTestIntegration
    17  	)
    18  
    19  	BeforeEach(func() {
    20  		tempdir, err = CreateTempDirInTempDir()
    21  		if err != nil {
    22  			os.Exit(1)
    23  		}
    24  		podmanTest = PodmanTestCreate(tempdir)
    25  		podmanTest.Setup()
    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).Should(Exit(0))
    39  
    40  		session = podmanTest.Podman([]string{"wait", "test"})
    41  		session.WaitWithDefaultTimeout()
    42  		Expect(session).Should(Exit(0))
    43  
    44  		session2 := podmanTest.Podman([]string{"start", "--attach", "test"})
    45  		session2.WaitWithDefaultTimeout()
    46  		Expect(session2).Should(Exit(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).Should(Exit(0))
    57  
    58  		session2 := podmanTest.Podman([]string{"start", "test1"})
    59  		session2.WaitWithDefaultTimeout()
    60  		Expect(session2).Should(Exit(0))
    61  	})
    62  })