mirror of https://github.com/docker/docker-py.git
Add ContainerSpec mounts test
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
370cdb6dc5
commit
f27ecf3f88
|
|
@ -8,8 +8,8 @@ import pytest
|
||||||
from docker.constants import DEFAULT_DOCKER_API_VERSION
|
from docker.constants import DEFAULT_DOCKER_API_VERSION
|
||||||
from docker.errors import InvalidArgument, InvalidVersion
|
from docker.errors import InvalidArgument, InvalidVersion
|
||||||
from docker.types import (
|
from docker.types import (
|
||||||
ContainerConfig, EndpointConfig, HostConfig, IPAMConfig, IPAMPool,
|
ContainerConfig, ContainerSpec, EndpointConfig, HostConfig, IPAMConfig,
|
||||||
LogConfig, Mount, ServiceMode, Ulimit,
|
IPAMPool, LogConfig, Mount, ServiceMode, Ulimit,
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
@ -220,6 +220,22 @@ class ContainerConfigTest(unittest.TestCase):
|
||||||
assert 'The volume_driver option has been moved' in str(w[0].message)
|
assert 'The volume_driver option has been moved' in str(w[0].message)
|
||||||
|
|
||||||
|
|
||||||
|
class ContainerSpecTest(unittest.TestCase):
|
||||||
|
def test_parse_mounts(self):
|
||||||
|
spec = ContainerSpec(
|
||||||
|
image='scratch', mounts=[
|
||||||
|
'/local:/container',
|
||||||
|
'/local2:/container2:ro',
|
||||||
|
Mount(target='/target', source='/source')
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
assert 'Mounts' in spec
|
||||||
|
assert len(spec['Mounts']) == 3
|
||||||
|
for mount in spec['Mounts']:
|
||||||
|
assert isinstance(mount, Mount)
|
||||||
|
|
||||||
|
|
||||||
class UlimitTest(unittest.TestCase):
|
class UlimitTest(unittest.TestCase):
|
||||||
def test_create_host_config_dict_ulimit(self):
|
def test_create_host_config_dict_ulimit(self):
|
||||||
ulimit_dct = {'name': 'nofile', 'soft': 8096}
|
ulimit_dct = {'name': 'nofile', 'soft': 8096}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue