mirror of
https://github.com/containers/podman.git
synced 2025-12-01 02:27:13 +08:00
Merge pull request #23985 from Luap99/wait-hang
wait: fix handling of multiple conditions with exited
This commit is contained in:
@@ -108,4 +108,19 @@ var _ = Describe("Podman wait", func() {
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session.OutputToStringArray()).To(Equal([]string{"0", "0", "0"}))
|
||||
})
|
||||
|
||||
It("podman wait on multiple conditions", func() {
|
||||
session := podmanTest.Podman([]string{"run", "-d", ALPINE, "sleep", "100"})
|
||||
session.Wait(20)
|
||||
Expect(session).Should(ExitCleanly())
|
||||
cid := session.OutputToString()
|
||||
|
||||
// condition should return once nay of the condition is met not all of them,
|
||||
// as the container is running this should return immediately
|
||||
// https://github.com/containers/podman-py/issues/425
|
||||
session = podmanTest.Podman([]string{"wait", "--condition", "running,exited", cid})
|
||||
session.Wait(20)
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session.OutputToString()).To(Equal("-1"))
|
||||
})
|
||||
})
|
||||
|
||||
@@ -136,10 +136,6 @@ function _log_test_restarted() {
|
||||
fi
|
||||
cname="c-ltr-$(safename)"
|
||||
run_podman run --log-driver=$driver ${events_backend} --name $cname $IMAGE sh -c 'start=0; if test -s log; then start=`tail -n 1 log`; fi; seq `expr $start + 1` `expr $start + 10` | tee -a log'
|
||||
# FIXME: #9597
|
||||
# run/start is flaking for remote so let's wait for the container condition
|
||||
# to stop wasting energy until the root cause gets fixed.
|
||||
run_podman container wait --condition=exited --condition=stopped $cname
|
||||
run_podman ${events_backend} start -a $cname
|
||||
logfile=$(mktemp -p ${PODMAN_TMPDIR} logfileXXXXXXXX)
|
||||
$PODMAN $_PODMAN_TEST_OPTS ${events_backend} logs -f $cname > $logfile
|
||||
|
||||
Reference in New Issue
Block a user