mirror of
https://github.com/docker/compose.git
synced 2026-08-31 23:03:55 +00:00
Merge deploy key in service dicts
Update merge_service_dicts() to merge deploy mappings. Compose file version 3 added the deploy key to service dicts to specify configs related to Docker services. Signed-off-by: King Chung Huang <kinghuang@mac.com>
This commit is contained in:
parent
489074ac78
commit
0e5acfa16c
2 changed files with 53 additions and 0 deletions
|
|
@ -1950,6 +1950,57 @@ class ConfigTest(unittest.TestCase):
|
|||
actual = config.merge_service_dicts(base, override, V3_1)
|
||||
assert actual['secrets'] == override['secrets']
|
||||
|
||||
def test_merge_deploy(self):
|
||||
base = {
|
||||
'image': 'busybox',
|
||||
}
|
||||
override = {
|
||||
'deploy': {
|
||||
'mode': 'global',
|
||||
'restart_policy': {
|
||||
'condition': 'on-failure'
|
||||
}
|
||||
}
|
||||
}
|
||||
actual = config.merge_service_dicts(base, override, V3_0)
|
||||
assert actual['deploy'] == override['deploy']
|
||||
|
||||
def test_merge_deploy_override(self):
|
||||
base = {
|
||||
'image': 'busybox',
|
||||
'deploy': {
|
||||
'mode': 'global',
|
||||
'restart_policy': {
|
||||
'condition': 'on-failure'
|
||||
},
|
||||
'placement': {
|
||||
'constraints': [
|
||||
'node.role == manager'
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
override = {
|
||||
'deploy': {
|
||||
'mode': 'replicated',
|
||||
'restart_policy': {
|
||||
'condition': 'any'
|
||||
}
|
||||
}
|
||||
}
|
||||
actual = config.merge_service_dicts(base, override, V3_0)
|
||||
assert actual['deploy'] == {
|
||||
'mode': 'replicated',
|
||||
'restart_policy': {
|
||||
'condition': 'any'
|
||||
},
|
||||
'placement': {
|
||||
'constraints': [
|
||||
'node.role == manager'
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
def test_external_volume_config(self):
|
||||
config_details = build_config_details({
|
||||
'version': '2',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue