summaryrefslogtreecommitdiff
path: root/test/system
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-01-14 13:37:16 -0500
committerGitHub <noreply@github.com>2021-01-14 13:37:16 -0500
commita1b49749af97c5a3b6256b5aa0f53897257bc838 (patch)
tree3aa0413a7fabc7faff920018b66dae54bc86120e /test/system
parente0211a14fc58657821a2af92d09f115470a38c36 (diff)
parentd54478d8eaec9481d482942b87065af36995d39a (diff)
downloadpodman-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/system')
-rw-r--r--test/system/050-stop.bats28
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