diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-01-14 13:37:16 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-14 13:37:16 -0500 |
commit | a1b49749af97c5a3b6256b5aa0f53897257bc838 (patch) | |
tree | 3aa0413a7fabc7faff920018b66dae54bc86120e /test | |
parent | e0211a14fc58657821a2af92d09f115470a38c36 (diff) | |
parent | d54478d8eaec9481d482942b87065af36995d39a (diff) | |
download | podman-a1b49749af97c5a3b6256b5aa0f53897257bc838.tar.gz podman-a1b49749af97c5a3b6256b5aa0f53897257bc838.tar.bz2 podman-a1b49749af97c5a3b6256b5aa0f53897257bc838.zip |
Merge pull request #8906 from vrothberg/fix-8501
container stop: release lock before calling the runtime
Diffstat (limited to 'test')
-rw-r--r-- | test/system/050-stop.bats | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/system/050-stop.bats b/test/system/050-stop.bats index f604ea2e2..548fd56ee 100644 --- a/test/system/050-stop.bats +++ b/test/system/050-stop.bats @@ -67,4 +67,32 @@ load helpers done } +# Regression test for #8501 +@test "podman stop - unlock while waiting for timeout" { + # Test that the container state transitions to "stopping" and that other + # commands can get the container's lock. To do that, run a container that + # ingores SIGTERM such that the Podman would wait 20 seconds for the stop + # to finish. This gives us enough time to try some commands and inspect + # the container's status. + + run_podman run --name stopme -d $IMAGE sh -c \ + "trap 'echo Received SIGTERM, ignoring' SIGTERM; echo READY; while :; do sleep 1; done" + + # Stop the container in the background + $PODMAN stop -t 20 stopme & + + # Other commands can acquire the lock + run_podman ps -a + + # The container state transitioned to "stopping" + run_podman inspect --format '{{.State.Status}}' stopme + is "$output" "stopping" "Status of container should be 'stopping'" + + run_podman kill stopme + + # Exit code should be 137 as it was killed + run_podman inspect --format '{{.State.ExitCode}}' stopme + is "$output" "137" "Exit code of killed container" +} + # vim: filetype=sh |