summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Jia <chuanchang.jia@gmail.com>2020-07-01 12:50:05 +0000
committerAlex Jia <chuanchang.jia@gmail.com>2020-07-01 12:50:05 +0000
commiteea96235f3b6310e4becd68b05df5cf78f277444 (patch)
tree54ad4407427ba486502aecf0fc504b42d4c6ade9 /test
parentd8718fd62e87d0a364a4092c6333d90e26ce9c8e (diff)
downloadpodman-eea96235f3b6310e4becd68b05df5cf78f277444.tar.gz
podman-eea96235f3b6310e4becd68b05df5cf78f277444.tar.bz2
podman-eea96235f3b6310e4becd68b05df5cf78f277444.zip
test.apiv2: add testing for container initializing
Signed-off-by: Alex Jia <chuanchang.jia@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/apiv2/20-containers.at32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/apiv2/20-containers.at b/test/apiv2/20-containers.at
index 9efebfeb9..25843e61c 100644
--- a/test/apiv2/20-containers.at
+++ b/test/apiv2/20-containers.at
@@ -98,9 +98,41 @@ t GET libpod/images/newrepo:v2/json 200 \
.Comment=bar \
.Config.Cmd[-1]="/bin/foo"
+# Create a container for testing the container initializing later
+podman create -t -i --name myctr $IMAGE ls
+
+# Check configuration before initializing
+t GET libpod/containers/myctr/json 200 \
+ .Id~[0-9a-f]\\{64\\} \
+ .State.Status="configured" \
+ .State.Pid=0 \
+ .ResolvConfPath="" \
+ .HostnamePath="" \
+ .HostsPath="" \
+ .NetworkSettings.SandboxKey=""
+
+cpid_file=$(jq -r '.ConmonPidFile' <<<"$output")
+userdata_path=$(dirname $cpid_file)
+
+# Initializing the container
+t POST libpod/containers/myctr/init '' 204
+
+# Check configuration after initializing
+t GET libpod/containers/myctr/json 200 \
+ .Id~[0-9a-f]\\{64\\} \
+ .State.Status="created" \
+ .State.Pid~[0-9]\\{1\,8\\} \
+ .ResolvConfPath=$userdata_path/resolv.conf \
+ .HostnamePath=$userdata_path/hostname \
+ .HostsPath=$userdata_path/hosts \
+ .NetworkSettings.SandboxKey~.*/netns/cni- \
+ .OCIConfigPath~.*config\.json \
+ .GraphDriver.Data.MergedDir~.*merged
+
t DELETE images/localhost/newrepo:latest?force=true 200
t DELETE images/localhost/newrepo:v1?force=true 200
t DELETE images/localhost/newrepo:v2?force=true 200
t DELETE libpod/containers/$cid 204
+t DELETE libpod/containers/myctr 204
# vim: filetype=sh