mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-08-05 00:15:44 +00:00
test/e2e: remove WaitForContainer
For most callers podman run -d already makes sure the container runs so this does nothing and only slows the test down. For the signal test we can instead check for container output which is better as we know the pid1 is actually ready to get the signal. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
parent
88c0167a3f
commit
a523791b27
6 changed files with 3 additions and 38 deletions
|
|
@ -109,7 +109,6 @@ var _ = Describe("Podman pod rm", func() {
|
|||
session := podmanTest.RunTopContainerInPod("", podid1)
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
podmanTest.WaitForContainer()
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
|
||||
GinkgoWriter.Printf("Started container running in one pod")
|
||||
|
||||
|
|
|
|||
|
|
@ -56,8 +56,6 @@ var _ = Describe("Podman restart", func() {
|
|||
|
||||
It("podman restart running container", func() {
|
||||
_ = podmanTest.RunTopContainer("test1")
|
||||
ok := WaitForContainer(podmanTest)
|
||||
Expect(ok).To(BeTrue(), "test1 container is up")
|
||||
startTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1"})
|
||||
startTime.WaitWithDefaultTimeout()
|
||||
|
||||
|
|
@ -71,8 +69,6 @@ var _ = Describe("Podman restart", func() {
|
|||
|
||||
It("podman container restart running container", func() {
|
||||
_ = podmanTest.RunTopContainer("test1")
|
||||
ok := WaitForContainer(podmanTest)
|
||||
Expect(ok).To(BeTrue(), "test1 container is up")
|
||||
startTime := podmanTest.Podman([]string{"container", "inspect", "--format='{{.State.StartedAt}}'", "test1"})
|
||||
startTime.WaitWithDefaultTimeout()
|
||||
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@ var _ = Describe("Podman run restart containers", func() {
|
|||
|
||||
It("Podman start after signal kill", func() {
|
||||
_ = podmanTest.RunTopContainer("test1")
|
||||
ok := WaitForContainer(podmanTest)
|
||||
Expect(ok).To(BeTrue(), "test1 container started")
|
||||
|
||||
killSession := podmanTest.Podman([]string{"kill", "-s", "9", "test1"})
|
||||
killSession.WaitWithDefaultTimeout()
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import (
|
|||
|
||||
const (
|
||||
sigCatch = "trap \"echo FOO >> /h/fifo \" 8; echo READY >> /h/fifo; while :; do sleep 0.25; done"
|
||||
sigCatch2 = "trap \"echo Received\" SIGFPE; while :; do sleep 0.25; done"
|
||||
sigCatch2 = "trap \"echo Received\" SIGFPE; echo READY; while :; do sleep 0.25; done"
|
||||
)
|
||||
|
||||
var _ = Describe("Podman run with --sig-proxy", func() {
|
||||
|
|
@ -95,7 +95,8 @@ var _ = Describe("Podman run with --sig-proxy", func() {
|
|||
signal := syscall.SIGFPE
|
||||
session, pid := podmanTest.PodmanPID([]string{"run", "--name", "test2", "--sig-proxy=false", FEDORA_MINIMAL, "bash", "-c", sigCatch2})
|
||||
|
||||
Expect(WaitForContainer(podmanTest)).To(BeTrue(), "WaitForContainer()")
|
||||
// need to ensure the process is ready to get signals
|
||||
Expect(podmanTest.WaitContainerReady("test2", "READY", 5, 1)).To(BeTrue(), "bash signal listener ready")
|
||||
|
||||
// Kill with given signal
|
||||
// Should be no output, SIGPOLL is usually ignored
|
||||
|
|
|
|||
|
|
@ -32,17 +32,6 @@ var _ = Describe("PodmanTest test", func() {
|
|||
Expect(podmanTest.NumberOfPods()).To(Equal(2))
|
||||
})
|
||||
|
||||
It("Test WaitForContainer", func() {
|
||||
FakeOutputs["ps -q"] = []string{"one", "two"}
|
||||
Expect(WaitForContainer(podmanTest)).To(BeTrue())
|
||||
|
||||
FakeOutputs["ps -q"] = []string{"one"}
|
||||
Expect(WaitForContainer(podmanTest)).To(BeTrue())
|
||||
|
||||
FakeOutputs["ps -q"] = []string{""}
|
||||
Expect(WaitForContainer(podmanTest)).To(Not(BeTrue()))
|
||||
})
|
||||
|
||||
It("Test GetContainerStatus", func() {
|
||||
FakeOutputs["ps --all --format={{.Status}}"] = []string{"Need func update"}
|
||||
Expect(podmanTest.GetContainerStatus()).To(Equal("Need func update"))
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ var (
|
|||
// the inheritance structs
|
||||
type PodmanTestCommon interface {
|
||||
MakeOptions(args []string, options PodmanExecOptions) []string
|
||||
WaitForContainer() bool
|
||||
WaitContainerReady(id string, expStr string, timeout int, step int) bool
|
||||
}
|
||||
|
||||
|
|
@ -148,18 +147,6 @@ func (p *PodmanTest) PodmanExecBaseWithOptions(args []string, options PodmanExec
|
|||
return &PodmanSession{session}
|
||||
}
|
||||
|
||||
// WaitForContainer waits on a started container
|
||||
func (p *PodmanTest) WaitForContainer() bool {
|
||||
for range 10 {
|
||||
if p.NumberOfContainersRunning() > 0 {
|
||||
return true
|
||||
}
|
||||
time.Sleep(1 * time.Second)
|
||||
}
|
||||
GinkgoWriter.Printf("WaitForContainer(): timed out\n")
|
||||
return false
|
||||
}
|
||||
|
||||
// NumberOfContainersRunning returns an int of how many
|
||||
// containers are currently running.
|
||||
func (p *PodmanTest) NumberOfContainersRunning() int {
|
||||
|
|
@ -247,11 +234,6 @@ func (p *PodmanTest) WaitContainerReady(id string, expStr string, timeout int, s
|
|||
}
|
||||
}
|
||||
|
||||
// WaitForContainer is a wrapper function for accept inheritance PodmanTest struct.
|
||||
func WaitForContainer(p PodmanTestCommon) bool {
|
||||
return p.WaitForContainer()
|
||||
}
|
||||
|
||||
// WaitContainerReady is a wrapper function for accept inheritance PodmanTest struct.
|
||||
func WaitContainerReady(p PodmanTestCommon, id string, expStr string, timeout int, step int) bool {
|
||||
return p.WaitContainerReady(id, expStr, timeout, step)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue