summaryrefslogtreecommitdiff
path: root/test/apiv2
diff options
context:
space:
mode:
authorchesedo <pieter@chesedo.me>2022-06-22 16:52:18 +0200
committerchesedo <pieter@chesedo.me>2022-06-28 15:50:45 +0200
commitcc49146332e279644f1357c6a5e209927bd73471 (patch)
tree7c646d49ac5947e90ce111e7e4c72ba9ab3c9cfa /test/apiv2
parent2382955c6a88e506ce6d85477c8c68bd24859bdd (diff)
downloadpodman-cc49146332e279644f1357c6a5e209927bd73471.tar.gz
podman-cc49146332e279644f1357c6a5e209927bd73471.tar.bz2
podman-cc49146332e279644f1357c6a5e209927bd73471.zip
Docker compat returning unknown "initialized" for `status.status`
Some background for this PR is in discussion #14641. In short, ever so often a container inspect will return a `status.status` of `initialized` from the Docker compat socket. From the discussion I found these lines which tries to fix a "configured" status to "created". https://github.com/containers/podman/blob/c936d1e61154b6826e9d8df46e9660aba6c86cfe/pkg/api/handlers/compat/containers.go#L291-L294 However, commit 141de8686289 (Revamp Libpod state strings for Docker compat) removed the "configured" return value from the `String()` method called on line 291 above. Thus, making the `if` check redundant as it will never hit. But the same commit also introduces a return for "initialized" which this `if` should probably have been adapted for. Signed-off-by: Pieter Engelbrecht <pieter@shuttle.rs>
Diffstat (limited to 'test/apiv2')
-rw-r--r--test/apiv2/20-containers.at24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/apiv2/20-containers.at b/test/apiv2/20-containers.at
index cfd6aab33..6ef4ef917 100644
--- a/test/apiv2/20-containers.at
+++ b/test/apiv2/20-containers.at
@@ -502,3 +502,27 @@ done
stop_service
start_service
+
+# Our states are different from Docker's.
+# Regression test for #14700 (Docker compat returning unknown "initialized" for status.status) to ensure the stay compatible
+podman create --name status-test $IMAGE sh -c "sleep 3"
+t GET containers/status-test/json 200 .State.Status="created"
+
+podman init status-test
+t GET containers/status-test/json 200 .State.Status="created"
+
+podman start status-test
+t GET containers/status-test/json 200 .State.Status="running"
+
+podman pause status-test
+t GET containers/status-test/json 200 .State.Status="paused"
+
+podman unpause status-test
+t GET containers/status-test/json 200 .State.Status="running"
+
+podman stop status-test &
+sleep 1
+t GET containers/status-test/json 200 .State.Status="stopping"
+
+sleep 3
+t GET containers/status-test/json 200 .State.Status="exited"