Constraint build argument types. Numbers are cast into strings
Numerical driver_opts are also valid and typecast into strings. Additional config tests. Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
8d7b1e9047
commit
fcf78fe3de
5 changed files with 44 additions and 5 deletions
|
|
@ -231,7 +231,7 @@ class ConfigTest(unittest.TestCase):
|
|||
assert volumes['simple'] == {}
|
||||
assert volumes['other'] == {}
|
||||
|
||||
def test_volume_invalid_driver_opt(self):
|
||||
def test_volume_numeric_driver_opt(self):
|
||||
config_details = build_config_details({
|
||||
'version': '2',
|
||||
'services': {
|
||||
|
|
@ -241,6 +241,19 @@ class ConfigTest(unittest.TestCase):
|
|||
'simple': {'driver_opts': {'size': 42}},
|
||||
}
|
||||
})
|
||||
cfg = config.load(config_details)
|
||||
assert cfg.volumes['simple']['driver_opts']['size'] == '42'
|
||||
|
||||
def test_volume_invalid_driver_opt(self):
|
||||
config_details = build_config_details({
|
||||
'version': '2',
|
||||
'services': {
|
||||
'simple': {'image': 'busybox'}
|
||||
},
|
||||
'volumes': {
|
||||
'simple': {'driver_opts': {'size': True}},
|
||||
}
|
||||
})
|
||||
with pytest.raises(ConfigurationError) as exc:
|
||||
config.load(config_details)
|
||||
assert 'driver_opts.size contains an invalid type' in exc.exconly()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue