Handle volume driver change error in config.
Assume version=1 if file is empty in get_config_version Empty files are invalid anyway, so this simplifies the algorithm somewhat. https://github.com/docker/compose/pull/2421#discussion_r47223144 Don't leak version considerations in interpolation/service validation Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
f3a9533dc0
commit
a7689f3da8
6 changed files with 94 additions and 21 deletions
|
|
@ -286,6 +286,18 @@ class ConfigTest(unittest.TestCase):
|
|||
error_msg = "Top level object in 'override.yml' needs to be an object"
|
||||
assert error_msg in exc.exconly()
|
||||
|
||||
def test_load_with_multiple_files_and_empty_override_v2(self):
|
||||
base_file = config.ConfigFile(
|
||||
'base.yml',
|
||||
{'version': 2, 'services': {'web': {'image': 'example/web'}}})
|
||||
override_file = config.ConfigFile('override.yml', None)
|
||||
details = config.ConfigDetails('.', [base_file, override_file])
|
||||
|
||||
with pytest.raises(ConfigurationError) as exc:
|
||||
config.load(details)
|
||||
error_msg = "Top level object in 'override.yml' needs to be an object"
|
||||
assert error_msg in exc.exconly()
|
||||
|
||||
def test_load_with_multiple_files_and_empty_base(self):
|
||||
base_file = config.ConfigFile('base.yml', None)
|
||||
override_file = config.ConfigFile(
|
||||
|
|
@ -297,6 +309,17 @@ class ConfigTest(unittest.TestCase):
|
|||
config.load(details)
|
||||
assert "Top level object in 'base.yml' needs to be an object" in exc.exconly()
|
||||
|
||||
def test_load_with_multiple_files_and_empty_base_v2(self):
|
||||
base_file = config.ConfigFile('base.yml', None)
|
||||
override_file = config.ConfigFile(
|
||||
'override.tml',
|
||||
{'version': 2, 'services': {'web': {'image': 'example/web'}}}
|
||||
)
|
||||
details = config.ConfigDetails('.', [base_file, override_file])
|
||||
with pytest.raises(ConfigurationError) as exc:
|
||||
config.load(details)
|
||||
assert "Top level object in 'base.yml' needs to be an object" in exc.exconly()
|
||||
|
||||
def test_load_with_multiple_files_and_extends_in_override_file(self):
|
||||
base_file = config.ConfigFile(
|
||||
'base.yaml',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue