summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-11-12 16:55:24 +0100
committerGitHub <noreply@github.com>2021-11-12 16:55:24 +0100
commit07f5a94711f602ad625e6e82e5653502a7cdb7dc (patch)
treedd25ec28a14f68a7f910f770501a142b1354e3f5 /test
parent19c79eeff3c7945bea81de309874365cf916bedd (diff)
parentb1c002342426fac0770e4a7d07a57018964724dd (diff)
downloadpodman-07f5a94711f602ad625e6e82e5653502a7cdb7dc.tar.gz
podman-07f5a94711f602ad625e6e82e5653502a7cdb7dc.tar.bz2
podman-07f5a94711f602ad625e6e82e5653502a7cdb7dc.zip
Merge pull request #12279 from mscherer/fix_11842
Always create working directory when using compat API
Diffstat (limited to 'test')
-rw-r--r--test/python/docker/compat/test_containers.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/python/docker/compat/test_containers.py b/test/python/docker/compat/test_containers.py
index 1ad1e7f15..e6f7d992d 100644
--- a/test/python/docker/compat/test_containers.py
+++ b/test/python/docker/compat/test_containers.py
@@ -251,3 +251,17 @@ class TestContainers(unittest.TestCase):
ctr.start()
ret, out = ctr.exec_run(["stat", "-c", "%u:%g", "/workspace"])
self.assertEqual(out.rstrip(), b'1042:1043', "UID/GID set in dockerfile")
+
+
+ def test_non_existant_workdir(self):
+ dockerfile = (B'FROM quay.io/libpod/alpine:latest\n'
+ B'USER root\n'
+ B'WORKDIR /workspace/scratch\n'
+ B'RUN touch test')
+ img: Image
+ img, out = self.client.images.build(fileobj=io.BytesIO(dockerfile))
+ ctr: Container = self.client.containers.create(image=img.id, detach=True, command="top",
+ volumes=["test_non_existant_workdir:/workspace"])
+ ctr.start()
+ ret, out = ctr.exec_run(["stat", "/workspace/scratch/test"])
+ self.assertEqual(ret, 0, "Working directory created if it doesn't exist")