diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2021-05-18 10:37:54 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2021-05-26 16:39:04 -0400 |
commit | de293c9802a79f83eef83a0ca278ebb22cfb685d (patch) | |
tree | 002393067198891b819afff9de236545c3faa811 /test | |
parent | 5b4ffc7ba79d0c3ad59cce17500c5a98ea686577 (diff) | |
download | podman-de293c9802a79f83eef83a0ca278ebb22cfb685d.tar.gz podman-de293c9802a79f83eef83a0ca278ebb22cfb685d.tar.bz2 podman-de293c9802a79f83eef83a0ca278ebb22cfb685d.zip |
Handle image user and exposed ports in podman play kube
Currently if a user runs an image with a user specified or
exposed ports with podman play kube, the fields are ignored.
Fixed: https://github.com/containers/podman/issues/9609
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/system/700-play.bats | 41 |
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 +} |