Add support for "isolation" in config
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
f65f89ad8c
commit
dc8a39f70d
4 changed files with 72 additions and 3 deletions
|
|
@ -794,6 +794,49 @@ class ProjectTest(DockerClientTestCase):
|
|||
assert 'LinkLocalIPs' in ipam_config
|
||||
assert ipam_config['LinkLocalIPs'] == ['169.254.8.8']
|
||||
|
||||
@v2_1_only()
|
||||
def test_up_with_isolation(self):
|
||||
self.require_api_version('1.24')
|
||||
config_data = config.Config(
|
||||
version=V2_1,
|
||||
services=[{
|
||||
'name': 'web',
|
||||
'image': 'busybox:latest',
|
||||
'isolation': 'default'
|
||||
}],
|
||||
volumes={},
|
||||
networks={}
|
||||
)
|
||||
project = Project.from_config(
|
||||
client=self.client,
|
||||
name='composetest',
|
||||
config_data=config_data
|
||||
)
|
||||
project.up()
|
||||
service_container = project.get_service('web').containers()[0]
|
||||
assert service_container.inspect()['HostConfig']['Isolation'] == 'default'
|
||||
|
||||
@v2_1_only()
|
||||
def test_up_with_invalid_isolation(self):
|
||||
self.require_api_version('1.24')
|
||||
config_data = config.Config(
|
||||
version=V2_1,
|
||||
services=[{
|
||||
'name': 'web',
|
||||
'image': 'busybox:latest',
|
||||
'isolation': 'foobar'
|
||||
}],
|
||||
volumes={},
|
||||
networks={}
|
||||
)
|
||||
project = Project.from_config(
|
||||
client=self.client,
|
||||
name='composetest',
|
||||
config_data=config_data
|
||||
)
|
||||
with self.assertRaises(ProjectError):
|
||||
project.up()
|
||||
|
||||
@v2_only()
|
||||
def test_project_up_with_network_internal(self):
|
||||
self.require_api_version('1.23')
|
||||
|
|
|
|||
|
|
@ -351,7 +351,7 @@ class ConfigTest(unittest.TestCase):
|
|||
base_file = config.ConfigFile(
|
||||
'base.yaml',
|
||||
{
|
||||
'version': '2.1',
|
||||
'version': V2_1,
|
||||
'services': {
|
||||
'web': {
|
||||
'image': 'example/web',
|
||||
|
|
@ -1330,7 +1330,7 @@ class ConfigTest(unittest.TestCase):
|
|||
'image': 'alpine',
|
||||
'group_add': ["docker", 777]
|
||||
}
|
||||
}
|
||||
}
|
||||
}))
|
||||
|
||||
assert actual.services == [
|
||||
|
|
@ -1341,6 +1341,25 @@ class ConfigTest(unittest.TestCase):
|
|||
}
|
||||
]
|
||||
|
||||
def test_isolation_option(self):
|
||||
actual = config.load(build_config_details({
|
||||
'version': V2_1,
|
||||
'services': {
|
||||
'web': {
|
||||
'image': 'win10',
|
||||
'isolation': 'hyperv'
|
||||
}
|
||||
}
|
||||
}))
|
||||
|
||||
assert actual.services == [
|
||||
{
|
||||
'name': 'web',
|
||||
'image': 'win10',
|
||||
'isolation': 'hyperv',
|
||||
}
|
||||
]
|
||||
|
||||
def test_merge_service_dicts_from_files_with_extends_in_base(self):
|
||||
base = {
|
||||
'volumes': ['.:/app'],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue