github.com/AbhinandanKurakure/podman/v3@v3.4.10/test/e2e/run_restart_test.go (about)

     1  package integration
     2  
     3  import (
     4  	"os"
     5  
     6  	. "github.com/containers/podman/v3/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  		podmanTest.SeedImages()
    27  	})
    28  
    29  	AfterEach(func() {
    30  		podmanTest.Cleanup()
    31  		f := CurrentGinkgoTestDescription()
    32  		processTestResult(f)
    33  
    34  	})
    35  
    36  	It("Podman start after successful run", func() {
    37  		session := podmanTest.Podman([]string{"run", "--name", "test", ALPINE, "ls"})
    38  		session.WaitWithDefaultTimeout()
    39  		Expect(session).Should(Exit(0))
    40  
    41  		session = podmanTest.Podman([]string{"wait", "test"})
    42  		session.WaitWithDefaultTimeout()
    43  		Expect(session).Should(Exit(0))
    44  
    45  		session2 := podmanTest.Podman([]string{"start", "--attach", "test"})
    46  		session2.WaitWithDefaultTimeout()
    47  		Expect(session2).Should(Exit(0))
    48  	})
    49  
    50  	It("Podman start after signal kill", func() {
    51  		_ = podmanTest.RunTopContainer("test1")
    52  		ok := WaitForContainer(podmanTest)
    53  		Expect(ok).To(BeTrue())
    54  
    55  		killSession := podmanTest.Podman([]string{"kill", "-s", "9", "test1"})
    56  		killSession.WaitWithDefaultTimeout()
    57  		Expect(killSession).Should(Exit(0))
    58  
    59  		session2 := podmanTest.Podman([]string{"start", "test1"})
    60  		session2.WaitWithDefaultTimeout()
    61  		Expect(session2).Should(Exit(0))
    62  	})
    63  })