mirror of https://github.com/docker/compose.git
Add config validation for service volumes, fixes #5352
Signed-off-by: Drew Romanyk <drewiswaycool@gmail.com>
This commit is contained in:
parent
3ce2f03d70
commit
dba2abd523
|
@ -245,6 +245,7 @@
|
|||
{
|
||||
"type": "object",
|
||||
"required": ["type"],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {"type": "string"},
|
||||
"source": {"type": "string"},
|
||||
|
|
|
@ -278,6 +278,7 @@
|
|||
{
|
||||
"type": "object",
|
||||
"required": ["type"],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {"type": "string"},
|
||||
"source": {"type": "string"},
|
||||
|
|
|
@ -282,6 +282,7 @@
|
|||
{
|
||||
"type": "object",
|
||||
"required": ["type"],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {"type": "string"},
|
||||
"source": {"type": "string"},
|
||||
|
|
|
@ -282,6 +282,7 @@
|
|||
{
|
||||
"type": "object",
|
||||
"required": ["type"],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {"type": "string"},
|
||||
"source": {"type": "string"},
|
||||
|
|
|
@ -2631,6 +2631,33 @@ class ConfigTest(unittest.TestCase):
|
|||
]
|
||||
assert service_sort(service_dicts) == service_sort(expected)
|
||||
|
||||
def test_service_volume_invalid_config(self):
|
||||
config_details = build_config_details(
|
||||
{
|
||||
'version': '3.2',
|
||||
'services': {
|
||||
'web': {
|
||||
'build': {
|
||||
'context': '.',
|
||||
'args': None,
|
||||
},
|
||||
'volumes': [
|
||||
{
|
||||
"type": "volume",
|
||||
"source": "/data",
|
||||
"garbage": {
|
||||
"and": "error"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
},
|
||||
}
|
||||
)
|
||||
with pytest.raises(ConfigurationError) as exc:
|
||||
config.load(config_details)
|
||||
assert "services.web.volumes contains unsupported option: 'garbage'" in exc.exconly()
|
||||
|
||||
|
||||
class NetworkModeTest(unittest.TestCase):
|
||||
|
||||
|
|
Loading…
Reference in New Issue