diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-07-12 12:53:55 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-12 12:53:55 -0400 |
commit | 561ef855706e9276cc66d4718db96389f3f32735 (patch) | |
tree | 8062e0c7cba3838260fb8950e8ff5328bac15dd9 /test | |
parent | f49fd0694dea711ce578c8016dc88607ff71ab12 (diff) | |
parent | 6cac65c841bc1b52780d8784c3fcca752d03eb1d (diff) | |
download | podman-561ef855706e9276cc66d4718db96389f3f32735.tar.gz podman-561ef855706e9276cc66d4718db96389f3f32735.tar.bz2 podman-561ef855706e9276cc66d4718db96389f3f32735.zip |
Merge pull request #10905 from matejvasek/fix-mount
fix: uid/gid for volume mounted to existing dir
Diffstat (limited to 'test')
-rw-r--r-- | test/python/docker/compat/test_containers.py | 14 |
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 511ab1451..38ac5b59f 100644 --- a/test/python/docker/compat/test_containers.py +++ b/test/python/docker/compat/test_containers.py @@ -7,6 +7,7 @@ from typing import IO, Optional from docker import DockerClient, errors from docker.models.containers import Container +from docker.models.images import Image from test.python.docker import Podman from test.python.docker.compat import common, constant @@ -237,3 +238,16 @@ class TestContainers(unittest.TestCase): if ctr is not None: ctr.stop() ctr.remove() + + def test_mount_preexisting_dir(self): + dockerfile = (B'FROM quay.io/libpod/alpine:latest\n' + B'USER root\n' + B'RUN mkdir -p /workspace\n' + B'RUN chown 1042:1043 /workspace') + 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_mount_preexisting_dir_vol:/workspace"]) + ctr.start() + ret, out = ctr.exec_run(["stat", "-c", "%u:%g", "/workspace"]) + self.assertTrue(out.startswith(b'1042:1043'), "assert correct uid/gid") |