diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-11-29 22:10:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-29 22:10:18 +0100 |
commit | 60529142223218483ea3d68975bea86aa89ac6fe (patch) | |
tree | 5476c0e2a334d7b0d3879b10bfed1f8c958dbecd /test | |
parent | c234c20a70304d526952f167c7c00122e5d54267 (diff) | |
parent | 697ff213dd36b78a4857c07b4c6a82246d0a875f (diff) | |
download | podman-60529142223218483ea3d68975bea86aa89ac6fe.tar.gz podman-60529142223218483ea3d68975bea86aa89ac6fe.tar.bz2 podman-60529142223218483ea3d68975bea86aa89ac6fe.zip |
Merge pull request #12433 from matejvasek/fix-mount-parsing
fix: parsing of HostConfig.Mounts for container create
Diffstat (limited to 'test')
-rw-r--r-- | test/python/docker/compat/test_containers.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/test/python/docker/compat/test_containers.py b/test/python/docker/compat/test_containers.py index d6eacd560..d14c09fc1 100644 --- a/test/python/docker/compat/test_containers.py +++ b/test/python/docker/compat/test_containers.py @@ -3,12 +3,13 @@ import subprocess import sys import time import unittest -from typing import IO, Optional +from typing import IO, Optional, List from docker import DockerClient, errors from docker.models.containers import Container from docker.models.images import Image from docker.models.volumes import Volume +from docker.types import Mount from test.python.docker import Podman from test.python.docker.compat import common, constant @@ -277,3 +278,25 @@ class TestContainers(unittest.TestCase): ctr.start() ret, out = ctr.exec_run(["stat", "/workspace/scratch/test"]) self.assertEqual(ret, 0, "Working directory created if it doesn't exist") + + def test_mount_rw_by_default(self): + ctr: Optional[Container] = None + vol: Optional[Volume] = None + try: + vol = self.client.volumes.create("test-volume") + ctr = self.client.containers.create(image="alpine", + detach=True, + command="top", + mounts=[Mount(target="/vol-mnt", + source="test-volume", + type='volume', + read_only=False)]) + ctr_inspect = self.client.api.inspect_container(ctr.id) + binds: List[str] = ctr_inspect["HostConfig"]["Binds"] + self.assertEqual(len(binds), 1) + self.assertEqual(binds[0], 'test-volume:/vol-mnt:rw,rprivate,nosuid,nodev,rbind') + finally: + if ctr is not None: + ctr.remove() + if vol is not None: + vol.remove(force=True) |