Validate additional files before merging them.
Consolidates all the top level config handling into `process_config_file` which is now used for both files and merge sources. Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
7466d14826
commit
98ad5a05e4
5 changed files with 45 additions and 37 deletions
|
|
@ -195,6 +195,19 @@ class ConfigTest(unittest.TestCase):
|
|||
]
|
||||
self.assertEqual(service_sort(service_dicts), service_sort(expected))
|
||||
|
||||
def test_load_with_multiple_files_and_invalid_override(self):
|
||||
base_file = config.ConfigFile(
|
||||
'base.yaml',
|
||||
{'web': {'image': 'example/web'}})
|
||||
override_file = config.ConfigFile(
|
||||
'override.yaml',
|
||||
{'bogus': 'thing'})
|
||||
details = config.ConfigDetails('.', [base_file, override_file])
|
||||
|
||||
with pytest.raises(ConfigurationError) as exc:
|
||||
config.load(details)
|
||||
assert 'Service "bogus" doesn\'t have any configuration' in exc.exconly()
|
||||
|
||||
def test_config_valid_service_names(self):
|
||||
for valid_name in ['_', '-', '.__.', '_what-up.', 'what_.up----', 'whatup']:
|
||||
config.load(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue