summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-07-06 14:28:03 -0400
committerGitHub <noreply@github.com>2020-07-06 14:28:03 -0400
commitf4708a5c49e49694307a63ce70d0b9c5fe5c310f (patch)
tree0bb95bfbc4d012e74c59e421ace2c4f8d172dfd1 /test
parent9532509c50113ac9470108e3492e2769bac533e8 (diff)
parenteea96235f3b6310e4becd68b05df5cf78f277444 (diff)
downloadpodman-f4708a5c49e49694307a63ce70d0b9c5fe5c310f.tar.gz
podman-f4708a5c49e49694307a63ce70d0b9c5fe5c310f.tar.bz2
podman-f4708a5c49e49694307a63ce70d0b9c5fe5c310f.zip
Merge pull request #6812 from chuanchang/add_apiv2_test
test.apiv2: add testing for container initializing
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