podman/test/e2e/wait_test.go
baude 49b3647410 Speed up test results
Stop all containers with a zero timeout prior to trying to rm -fa.  This results
in quicker teardown times by not waiting for timeouts.

Also, with wait tests, no need to wait the full 10 second sleep.  1 will do.

Signed-off-by: baude <bbaude@redhat.com>

Closes: #1181
Approved by: rhatdan
2018-07-30 12:26:39 +00:00

67 lines
1.6 KiB
Go

package integration
import (
"fmt"
"os"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Podman wait", func() {
var (
tempdir string
err error
podmanTest PodmanTest
)
BeforeEach(func() {
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
}
podmanTest = PodmanCreate(tempdir)
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
GinkgoWriter.Write([]byte(timedResult))
})
It("podman wait on bogus container", func() {
session := podmanTest.Podman([]string{"wait", "1234"})
session.Wait()
Expect(session.ExitCode()).To(Equal(125))
})
It("podman wait on a stopped container", func() {
session := podmanTest.Podman([]string{"run", "-d", ALPINE, "ls"})
session.Wait(10)
cid := session.OutputToString()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.Podman([]string{"wait", cid})
session.Wait()
})
It("podman wait on a sleeping container", func() {
session := podmanTest.Podman([]string{"run", "-d", ALPINE, "sleep", "1"})
session.Wait(20)
cid := session.OutputToString()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.Podman([]string{"wait", cid})
session.Wait(20)
})
It("podman wait on latest container", func() {
session := podmanTest.Podman([]string{"run", "-d", ALPINE, "sleep", "1"})
session.Wait(20)
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.Podman([]string{"wait", "-l"})
session.Wait(20)
})
})