2018-03-13 19:12:52 +00:00
|
|
|
package integration
|
|
|
|
|
|
|
|
import (
|
2018-07-28 16:11:31 +00:00
|
|
|
"fmt"
|
2018-03-13 19:12:52 +00:00
|
|
|
"os"
|
|
|
|
|
2018-10-29 06:56:07 +00:00
|
|
|
. "github.com/containers/libpod/test/utils"
|
2018-03-13 19:12:52 +00:00
|
|
|
. "github.com/onsi/ginkgo"
|
|
|
|
. "github.com/onsi/gomega"
|
|
|
|
)
|
|
|
|
|
|
|
|
var _ = Describe("Podman run restart containers", func() {
|
|
|
|
var (
|
|
|
|
tempdir string
|
|
|
|
err error
|
2018-10-29 06:56:07 +00:00
|
|
|
podmanTest *PodmanTestIntegration
|
2018-03-13 19:12:52 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
BeforeEach(func() {
|
|
|
|
tempdir, err = CreateTempDirInTempDir()
|
|
|
|
if err != nil {
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
2018-10-29 06:56:07 +00:00
|
|
|
podmanTest = PodmanTestCreate(tempdir)
|
2018-03-13 19:12:52 +00:00
|
|
|
podmanTest.RestoreAllArtifacts()
|
|
|
|
})
|
|
|
|
|
|
|
|
AfterEach(func() {
|
|
|
|
podmanTest.Cleanup()
|
2018-07-28 16:11:31 +00:00
|
|
|
f := CurrentGinkgoTestDescription()
|
|
|
|
timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
|
|
|
|
GinkgoWriter.Write([]byte(timedResult))
|
2018-03-13 19:12:52 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
It("Podman start after successful run", func() {
|
|
|
|
session := podmanTest.Podman([]string{"run", ALPINE, "ls"})
|
|
|
|
session.WaitWithDefaultTimeout()
|
|
|
|
Expect(session.ExitCode()).To(Equal(0))
|
|
|
|
|
|
|
|
session2 := podmanTest.Podman([]string{"start", "--attach", "--latest"})
|
|
|
|
session2.WaitWithDefaultTimeout()
|
|
|
|
Expect(session2.ExitCode()).To(Equal(0))
|
|
|
|
})
|
2018-03-15 15:03:30 +00:00
|
|
|
|
|
|
|
It("Podman start after signal kill", func() {
|
2018-03-15 15:42:29 +00:00
|
|
|
_ = podmanTest.RunTopContainer("test1")
|
2018-10-29 06:56:07 +00:00
|
|
|
ok := WaitForContainer(podmanTest)
|
2018-03-15 15:03:30 +00:00
|
|
|
Expect(ok).To(BeTrue())
|
|
|
|
|
|
|
|
killSession := podmanTest.Podman([]string{"kill", "-s", "9", "test1"})
|
|
|
|
killSession.WaitWithDefaultTimeout()
|
|
|
|
Expect(killSession.ExitCode()).To(Equal(0))
|
|
|
|
|
2018-04-13 19:26:35 +00:00
|
|
|
session2 := podmanTest.Podman([]string{"start", "test1"})
|
2018-03-15 15:03:30 +00:00
|
|
|
session2.WaitWithDefaultTimeout()
|
|
|
|
Expect(session2.ExitCode()).To(Equal(0))
|
|
|
|
})
|
2018-03-13 19:12:52 +00:00
|
|
|
})
|