From 612c0f3d0de298884b80766d285f8ad47ad742a0 Mon Sep 17 00:00:00 2001 From: Madhuri Kumari Date: Thu, 1 Jun 2017 16:53:58 +0000 Subject: [PATCH] Fix test cases for ``runtime`` config Signed-off-by: Madhuri Kumari --- docker/api/container.py | 4 ++-- docker/models/containers.py | 2 +- docker/types/containers.py | 2 ++ docs/change-log.md | 2 -- tests/integration/api_container_test.py | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docker/api/container.py b/docker/api/container.py index 0abfca4f..2352df9b 100644 --- a/docker/api/container.py +++ b/docker/api/container.py @@ -417,7 +417,7 @@ class ContainerApiMixin(object): Default: 10 networking_config (dict): A networking configuration generated by :py:meth:`create_networking_config`. - runtime (str): The name of the runtime tool to create container. + runtime (str): Runtime to use with this container. Returns: A dictionary with an image 'Id' key and a 'Warnings' key. @@ -577,7 +577,7 @@ class ContainerApiMixin(object): values are: ``host`` volumes_from (:py:class:`list`): List of container names or IDs to get volumes from. - runtime (str): The name of the runtime tool to manage container. + runtime (str): Runtime to use with this container. Returns: diff --git a/docker/models/containers.py b/docker/models/containers.py index 46f900e0..300c5a9d 100644 --- a/docker/models/containers.py +++ b/docker/models/containers.py @@ -659,7 +659,7 @@ class ContainerCollection(Collection): volumes_from (:py:class:`list`): List of container names or IDs to get volumes from. working_dir (str): Path to the working directory. - runtime (str): The name of the runtime tool to create container. + runtime (str): Runtime to use with this container. Returns: The container logs, either ``STDOUT``, ``STDERR``, or both, diff --git a/docker/types/containers.py b/docker/types/containers.py index f834c785..6bbb57ae 100644 --- a/docker/types/containers.py +++ b/docker/types/containers.py @@ -474,6 +474,8 @@ class HostConfig(dict): self['NanoCpus'] = nano_cpus if runtime: + if version_lt(version, '1.25'): + raise host_config_version_error('runtime', '1.25') self['Runtime'] = runtime diff --git a/docs/change-log.md b/docs/change-log.md index 20bf9e09..3d58f931 100644 --- a/docs/change-log.md +++ b/docs/change-log.md @@ -122,8 +122,6 @@ Change log * Added support for `force_update` in `TaskTemplate` * Made `name` parameter optional in `APIClient.create_volume` and `DockerClient.volumes.create` -* Added support for `runtime` in `APIClient.create_container` and - `DockerClient.containers.run` ### Bugfixes diff --git a/tests/integration/api_container_test.py b/tests/integration/api_container_test.py index c499e35e..de3fe718 100644 --- a/tests/integration/api_container_test.py +++ b/tests/integration/api_container_test.py @@ -1255,14 +1255,14 @@ class ContainerCPUTest(BaseAPIIntegrationTest): inspect_data = self.client.inspect_container(container) self.assertEqual(inspect_data['HostConfig']['CpusetCpus'], cpuset_cpus) - - def test_create_with_runtime(self): + @requires_api_version('1.25') + def test_create_with_runtime(self): container = self.client.create_container( BUSYBOX, ['echo', 'test'], runtime='runc' ) self.tmp_containers.append(container['Id']) config = self.client.inspect_container(container) - assert config['Config']['Runtime'] == 'runc' + assert config['HostConfig']['Runtime'] == 'runc' class LinkTest(BaseAPIIntegrationTest):