summaryrefslogtreecommitdiff
path: root/test/apiv2/20-containers.at
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-10-01 10:00:15 -0400
committerGitHub <noreply@github.com>2020-10-01 10:00:15 -0400
commit3948cb76e266e930e0f1762b7145f72d65baf39f (patch)
treec9a6f8d79962dd1aa6a3b8a1824aafa024b14816 /test/apiv2/20-containers.at
parent556117c2e95bb0e4da7d36e10d94c3ec0ac4072f (diff)
parentcde367c1c0b348366fcaf4d8fac3b753de8456d5 (diff)
downloadpodman-3948cb76e266e930e0f1762b7145f72d65baf39f.tar.gz
podman-3948cb76e266e930e0f1762b7145f72d65baf39f.tar.bz2
podman-3948cb76e266e930e0f1762b7145f72d65baf39f.zip
Merge pull request #7851 from zhangguanzhang/fix-apiv2-ctr-workdir-and-env
[apiv2] don't ignore the ENV and WorkDir from the image
Diffstat (limited to 'test/apiv2/20-containers.at')
-rw-r--r--test/apiv2/20-containers.at23
1 files changed, 22 insertions, 1 deletions
diff --git a/test/apiv2/20-containers.at b/test/apiv2/20-containers.at
index 187073fb9..15b5dc4be 100644
--- a/test/apiv2/20-containers.at
+++ b/test/apiv2/20-containers.at
@@ -3,8 +3,11 @@
# test container-related endpoints
#
-podman pull $IMAGE &>/dev/null
+# WORKDIR=/data
+ENV_WORKDIR_IMG=docker.io/library/redis:alpine
+podman pull $IMAGE &>/dev/null
+podman pull $ENV_WORKDIR_IMG &>/dev/null
# Unimplemented
#t POST libpod/containers/create '' 201 'sdf'
@@ -203,4 +206,22 @@ t POST containers/${cid_top}/stop "" 204
t DELETE containers/$cid 204
t DELETE containers/$cid_top 204
+# test the apiv2 create, should't ignore the ENV and WORKDIR from the image
+t POST containers/create '"Image":"'$ENV_WORKDIR_IMG'","Env":["testKey1"]' 201 \
+ .Id~[0-9a-f]\\{64\\}
+cid=$(jq -r '.Id' <<<"$output")
+t GET containers/$cid/json 200 \
+ .Config.Env~"REDIS_VERSION=" \
+ .Config.Env~"testEnv1=" \
+ .Config.WorkingDir="/data" # default is /data
+t DELETE containers/$cid 204
+
+# test the WORKDIR
+t POST containers/create '"Image":"'$ENV_WORKDIR_IMG'","WorkingDir":"/dataDir"' 201 \
+ .Id~[0-9a-f]\\{64\\}
+cid=$(jq -r '.Id' <<<"$output")
+t GET containers/$cid/json 200 \
+ .Config.WorkingDir="/dataDir"
+t DELETE containers/$cid 204
+
# vim: filetype=sh