mirror of https://github.com/docker/compose.git
Fix config merging for isolation and storage_opt keys
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
8a0090c18c
commit
4682e766a3
|
@ -91,6 +91,7 @@ DOCKER_CONFIG_KEYS = [
|
|||
'healthcheck',
|
||||
'image',
|
||||
'ipc',
|
||||
'isolation',
|
||||
'labels',
|
||||
'links',
|
||||
'mac_address',
|
||||
|
@ -1042,6 +1043,7 @@ def merge_service_dicts(base, override, version):
|
|||
md.merge_mapping('networks', parse_networks)
|
||||
md.merge_mapping('sysctls', parse_sysctls)
|
||||
md.merge_mapping('depends_on', parse_depends_on)
|
||||
md.merge_mapping('storage_opt', parse_flat_dict)
|
||||
md.merge_sequence('links', ServiceLink.parse)
|
||||
md.merge_sequence('secrets', types.ServiceSecret.parse)
|
||||
md.merge_sequence('configs', types.ServiceConfig.parse)
|
||||
|
|
|
@ -85,6 +85,7 @@ HOST_CONFIG_KEYS = [
|
|||
'group_add',
|
||||
'init',
|
||||
'ipc',
|
||||
'isolation',
|
||||
'read_only',
|
||||
'log_driver',
|
||||
'log_opt',
|
||||
|
|
|
@ -2644,6 +2644,45 @@ class ConfigTest(unittest.TestCase):
|
|||
['c 7:128 rwm', 'x 3:244 rw', 'f 0:128 n']
|
||||
)
|
||||
|
||||
def test_merge_isolation(self):
|
||||
base = {
|
||||
'image': 'bar',
|
||||
'isolation': 'default',
|
||||
}
|
||||
|
||||
override = {
|
||||
'isolation': 'hyperv',
|
||||
}
|
||||
|
||||
actual = config.merge_service_dicts(base, override, V2_3)
|
||||
assert actual == {
|
||||
'image': 'bar',
|
||||
'isolation': 'hyperv',
|
||||
}
|
||||
|
||||
def test_merge_storage_opt(self):
|
||||
base = {
|
||||
'image': 'bar',
|
||||
'storage_opt': {
|
||||
'size': '1G',
|
||||
'readonly': 'false',
|
||||
}
|
||||
}
|
||||
|
||||
override = {
|
||||
'storage_opt': {
|
||||
'size': '2G',
|
||||
'encryption': 'aes',
|
||||
}
|
||||
}
|
||||
|
||||
actual = config.merge_service_dicts(base, override, V2_3)
|
||||
assert actual['storage_opt'] == {
|
||||
'size': '2G',
|
||||
'readonly': 'false',
|
||||
'encryption': 'aes',
|
||||
}
|
||||
|
||||
def test_external_volume_config(self):
|
||||
config_details = build_config_details({
|
||||
'version': '2',
|
||||
|
|
Loading…
Reference in New Issue