diff options
author | Joffrey F <joffrey@docker.com> | 2016-09-29 16:30:51 -0700 |
---|---|---|
committer | Joffrey F <joffrey@docker.com> | 2016-09-29 16:34:36 -0700 |
commit | 49997d040ba8e35f0d73bb0846b5b90cfa00b5d7 (patch) | |
tree | 1f6c5b8ff35f06fbc464ad85388d7319b71410ea /tests | |
parent | 2b34e0b8e44597b36d888b3f3272641f602cb6da (diff) | |
download | docker-py-host_config_isolation.tar.gz |
Add support for isolation param in host confighost_config_isolation
Signed-off-by: Joffrey F <joffrey@docker.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/integration/container_test.py | 11 | ||||
-rw-r--r-- | tests/unit/utils_test.py | 13 |
2 files changed, 23 insertions, 1 deletions
diff --git a/tests/integration/container_test.py b/tests/integration/container_test.py index 4bb78bf..c8e5eff 100644 --- a/tests/integration/container_test.py +++ b/tests/integration/container_test.py @@ -397,6 +397,17 @@ class CreateContainerTest(helpers.BaseTestCase): config = self.client.inspect_container(container) assert config['HostConfig']['Tmpfs'] == tmpfs + @requires_api_version('1.24') + def test_create_with_isolation(self): + container = self.client.create_container( + BUSYBOX, ['echo'], host_config=self.client.create_host_config( + isolation='default' + ) + ) + self.tmp_containers.append(container['Id']) + config = self.client.inspect_container(container) + assert config['HostConfig']['Isolation'] == 'default' + class VolumeBindTest(helpers.BaseTestCase): def setUp(self): diff --git a/tests/unit/utils_test.py b/tests/unit/utils_test.py index 2a2759d..83bda33 100644 --- a/tests/unit/utils_test.py +++ b/tests/unit/utils_test.py @@ -192,7 +192,18 @@ class HostConfigTest(base.BaseTestCase): with pytest.raises(InvalidVersion): create_host_config(version='1.22', pids_limit=1024) with pytest.raises(TypeError): - create_host_config(version='1.22', pids_limit='1024') + create_host_config(version='1.23', pids_limit='1024') + + def test_create_host_config_with_isolation(self): + config = create_host_config(version='1.24', isolation='hyperv') + self.assertEqual(config.get('Isolation'), 'hyperv') + + with pytest.raises(InvalidVersion): + create_host_config(version='1.23', isolation='hyperv') + with pytest.raises(TypeError): + create_host_config( + version='1.24', isolation={'isolation': 'hyperv'} + ) class UlimitTest(base.BaseTestCase): |