mirror of
https://github.com/containers/podman.git
synced 2025-06-29 06:57:13 +08:00
Merge pull request #16129 from edsantiago/fix-16075
system tests: health-on-failure: fix broken logic
This commit is contained in:
@ -314,7 +314,7 @@ LISTEN_FDNAMES=listen_fdnames" | sort)
|
|||||||
img="healthcheck_i"
|
img="healthcheck_i"
|
||||||
_build_health_check_image $img
|
_build_health_check_image $img
|
||||||
|
|
||||||
cname=$(random_string)
|
cname=c_$(random_string)
|
||||||
run_podman create --name $cname \
|
run_podman create --name $cname \
|
||||||
--health-cmd /healthcheck \
|
--health-cmd /healthcheck \
|
||||||
--health-on-failure=kill \
|
--health-on-failure=kill \
|
||||||
@ -345,7 +345,11 @@ LISTEN_FDNAMES=listen_fdnames" | sort)
|
|||||||
# Wait at most 10 seconds for the service to be restarted
|
# Wait at most 10 seconds for the service to be restarted
|
||||||
local timeout=10
|
local timeout=10
|
||||||
while [[ $timeout -gt 1 ]]; do
|
while [[ $timeout -gt 1 ]]; do
|
||||||
run_podman '?' container inspect $cname
|
# Possible outcomes:
|
||||||
|
# - status 0, old container is still terminating: sleep and retry
|
||||||
|
# - status 0, new CID: yay, break
|
||||||
|
# - status 1, container not found: sleep and retry
|
||||||
|
run_podman '?' container inspect $cname --format '{{.ID}}'
|
||||||
if [[ $status == 0 ]]; then
|
if [[ $status == 0 ]]; then
|
||||||
if [[ "$output" != "$oldID" ]]; then
|
if [[ "$output" != "$oldID" ]]; then
|
||||||
break
|
break
|
||||||
|
Reference in New Issue
Block a user