summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-05-27 21:18:05 +0200
committerGitHub <noreply@github.com>2021-05-27 21:18:05 +0200
commit3d8f37120d95c9a2d3293acdea6ab01a4c066806 (patch)
tree8c0cc5fd1fa335127a0158626f2d243f5cddf356 /test
parent3223cb56dd1cbac1461d03eed6e0597540a89d0a (diff)
parentde293c9802a79f83eef83a0ca278ebb22cfb685d (diff)
downloadpodman-3d8f37120d95c9a2d3293acdea6ab01a4c066806.tar.gz
podman-3d8f37120d95c9a2d3293acdea6ab01a4c066806.tar.bz2
podman-3d8f37120d95c9a2d3293acdea6ab01a4c066806.zip
Merge pull request #10383 from rhatdan/kube
Handle image user and exposed ports in podman play kube
Diffstat (limited to 'test')
-rw-r--r--test/system/700-play.bats41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/system/700-play.bats b/test/system/700-play.bats
index bcd8cf939..15f3e240a 100644
--- a/test/system/700-play.bats
+++ b/test/system/700-play.bats
@@ -88,3 +88,44 @@ RELABEL="system_u:object_r:container_file_t:s0"
fi
run_podman pod rm -f test_pod
}
+
+@test "podman play with user from image" {
+ TESTDIR=$PODMAN_TMPDIR/testdir
+ mkdir -p $TESTDIR
+
+testUserYaml="
+apiVersion: v1
+kind: Pod
+metadata:
+ labels:
+ app: test
+ name: test_pod
+spec:
+ containers:
+ - command:
+ - id
+ env:
+ - name: PATH
+ value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+ - name: TERM
+ value: xterm
+ - name: container
+ value: podman
+ image: userimage
+ name: test
+ resources: {}
+status: {}
+"
+
+cat > $PODMAN_TMPDIR/Containerfile << _EOF
+from $IMAGE
+USER bin
+_EOF
+
+ echo "$testUserYaml" | sed "s|TESTDIR|${TESTDIR}|g" > $PODMAN_TMPDIR/test.yaml
+ run_podman build -t userimage $PODMAN_TMPDIR
+ run_podman play kube --start=false $PODMAN_TMPDIR/test.yaml
+ run_podman inspect --format "{{ .Config.User }}" test_pod-test
+ is "$output" bin "expect container within pod to run as the bin user"
+ run_podman pod rm -f test_pod
+}