Add extra E2E test for restarting containers

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #482
Approved by: baude
This commit is contained in:
Matthew Heon
2018-03-15 11:03:30 -04:00
committed by Atomic Bot
parent 1856703e38
commit 8d7dc94a27
2 changed files with 26 additions and 0 deletions

View File

@ -166,6 +166,18 @@ func (p *PodmanTest) Podman(args []string) *PodmanSession {
return &PodmanSession{session} return &PodmanSession{session}
} }
//WaitForContainer waits on a started container
func WaitForContainer(p *PodmanTest) bool {
for i := 0; i < 10; i++ {
if p.NumberOfContainers() == 1 {
return true
}
time.Sleep(1 * time.Second)
}
return false
}
// Cleanup cleans up the temporary store // Cleanup cleans up the temporary store
func (p *PodmanTest) Cleanup() { func (p *PodmanTest) Cleanup() {
// Remove all containers // Remove all containers

View File

@ -36,4 +36,18 @@ var _ = Describe("Podman run restart containers", func() {
session2.WaitWithDefaultTimeout() session2.WaitWithDefaultTimeout()
Expect(session2.ExitCode()).To(Equal(0)) Expect(session2.ExitCode()).To(Equal(0))
}) })
It("Podman start after signal kill", func() {
session := podmanTest.RunTopContainer("test1")
ok := WaitForContainer(&podmanTest)
Expect(ok).To(BeTrue())
killSession := podmanTest.Podman([]string{"kill", "-s", "9", "test1"})
killSession.WaitWithDefaultTimeout()
Expect(killSession.ExitCode()).To(Equal(0))
session2 := podmanTest.Podman([]string{"start", "--attach", "test1"})
session2.WaitWithDefaultTimeout()
Expect(session2.ExitCode()).To(Equal(0))
})
}) })