Skip to content

Commit d1d38b2

Browse files
Merge pull request #21011 from edsantiago/wait_wait_wait
CI: safer podman-stop tests
2 parents 2258329 + 1c59a9c commit d1d38b2

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

test/e2e/common_test.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,8 +508,17 @@ func (p *PodmanTestIntegration) RunTopContainerWithArgs(name string, args []stri
508508
podmanArgs = append(podmanArgs, "--name", name)
509509
}
510510
podmanArgs = append(podmanArgs, args...)
511-
podmanArgs = append(podmanArgs, "-d", ALPINE, "top")
512-
return p.Podman(podmanArgs)
511+
podmanArgs = append(podmanArgs, "-d", ALPINE, "top", "-b")
512+
session := p.Podman(podmanArgs)
513+
session.WaitWithDefaultTimeout()
514+
Expect(session).To(ExitCleanly())
515+
cid := session.OutputToString()
516+
// Output indicates that top is running, which means it's safe
517+
// for our caller to invoke `podman stop`
518+
if !WaitContainerReady(p, cid, "Mem:", 20, 1) {
519+
Fail("Could not start a top container")
520+
}
521+
return session
513522
}
514523

515524
// RunLsContainer runs a simple container in the background that

test/e2e/prune_test.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,7 @@ var _ = Describe("Podman prune", func() {
220220
session = podmanTest.Podman([]string{"pod", "start", podid1})
221221
session.WaitWithDefaultTimeout()
222222
Expect(session).Should(ExitCleanly())
223-
224-
session = podmanTest.Podman([]string{"pod", "stop", podid1})
223+
session = podmanTest.Podman([]string{"pod", "stop", "-t0", podid1})
225224
session.WaitWithDefaultTimeout()
226225
Expect(session).Should(ExitCleanly())
227226

@@ -294,8 +293,7 @@ var _ = Describe("Podman prune", func() {
294293
session = podmanTest.Podman([]string{"pod", "start", podid1})
295294
session.WaitWithDefaultTimeout()
296295
Expect(session).Should(ExitCleanly())
297-
298-
session = podmanTest.Podman([]string{"pod", "stop", podid1})
296+
session = podmanTest.Podman([]string{"pod", "stop", "-t0", podid1})
299297
session.WaitWithDefaultTimeout()
300298
Expect(session).Should(ExitCleanly())
301299

@@ -327,8 +325,7 @@ var _ = Describe("Podman prune", func() {
327325
session = podmanTest.Podman([]string{"pod", "start", podid1})
328326
session.WaitWithDefaultTimeout()
329327
Expect(session).Should(ExitCleanly())
330-
331-
session = podmanTest.Podman([]string{"pod", "stop", podid1})
328+
session = podmanTest.Podman([]string{"pod", "stop", "-t0", podid1})
332329
session.WaitWithDefaultTimeout()
333330
Expect(session).Should(ExitCleanly())
334331

test/system/050-stop.bats

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,15 @@ load helpers
7777
# stop -a must print the IDs
7878
run_podman run -d $IMAGE top
7979
ctrID="$output"
80+
# Output means container has set up its signal handlers
81+
wait_for_output "Mem:" $ctrID
8082
run_podman stop --all
8183
is "$output" "$ctrID"
8284

8385
# stop $input must print $input
8486
cname=$(random_string)
8587
run_podman run -d --name $cname $IMAGE top
88+
wait_for_output "Mem:" $cname
8689
run_podman stop $cname
8790
is "$output" $cname
8891

0 commit comments

Comments
 (0)