summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2022-02-21 17:12:22 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2022-03-01 08:47:09 -0500
commit675d775eb54f1614a542dfcbbc5a4aa857cc0db0 (patch)
tree38e8d87f56d418a6760e7a30df76c56a6f939247 /test
parent8bdda91ab738d634528259581c8adebe1db007b4 (diff)
downloadpodman-675d775eb54f1614a542dfcbbc5a4aa857cc0db0.tar.gz
podman-675d775eb54f1614a542dfcbbc5a4aa857cc0db0.tar.bz2
podman-675d775eb54f1614a542dfcbbc5a4aa857cc0db0.zip
Add --context-dir option to podman play kube
This option was requested so that users could specify alternate locations to find context directories for each image build. It requites the --build option to be set. Partion Fix: https://github.com/containers/podman/issues/12485 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/system/700-play.bats52
1 files changed, 52 insertions, 0 deletions
diff --git a/test/system/700-play.bats b/test/system/700-play.bats
index 88c7cad87..07c5d124f 100644
--- a/test/system/700-play.bats
+++ b/test/system/700-play.bats
@@ -168,3 +168,55 @@ _EOF
run_podman pod rm -t 0 -f test_pod
run_podman rmi -f userimage:latest
}
+
+@test "podman play --build --context-dir" {
+ skip_if_remote "--build is not supported in context remote"
+ 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: quay.io/libpod/userimage
+ name: test
+ resources: {}
+status: {}
+"
+
+mkdir -p $PODMAN_TMPDIR/userimage
+cat > $PODMAN_TMPDIR/userimage/Containerfile << _EOF
+from $IMAGE
+USER bin
+_EOF
+
+ echo "$testUserYaml" > $PODMAN_TMPDIR/test.yaml
+ run_podman 125 play kube --build --start=false $PODMAN_TMPDIR/test.yaml
+ run_podman play kube --replace --context-dir=$PODMAN_TMPDIR --build --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 stop -a -t 0
+ run_podman pod rm -t 0 -f test_pod
+ run_podman rmi -f userimage:latest
+
+ cd $PODMAN_TMPDIR
+ run_podman play kube --replace --build --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 stop -a -t 0
+ run_podman pod rm -t 0 -f test_pod
+ run_podman rmi -f userimage:latest
+}