summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoffrey F <f.joffrey@gmail.com>2017-12-01 12:19:23 -0800
committerGitHub <noreply@github.com>2017-12-01 12:19:23 -0800
commit43fc651364c43c162b499c88d6ca97838a53c2de (patch)
tree04fe747695bd3314952202c24f5c3e570727fa7b
parent8bc6334ba5922b8fc20076d6d396901c07f1bdc2 (diff)
parentbee6046043d09540da7e33f8575413cb4836fb7c (diff)
Merge pull request #5418 from nginth/5352-fix-volume-config
Add config validation for service volumes, fixes #5352
-rw-r--r--compose/config/config_schema_v3.2.json1
-rw-r--r--compose/config/config_schema_v3.3.json1
-rw-r--r--compose/config/config_schema_v3.4.json1
-rw-r--r--compose/config/config_schema_v3.5.json1
-rw-r--r--tests/unit/config/config_test.py27
5 files changed, 31 insertions, 0 deletions
diff --git a/compose/config/config_schema_v3.2.json b/compose/config/config_schema_v3.2.json
index e4f8fe6d..70424444 100644
--- a/compose/config/config_schema_v3.2.json
+++ b/compose/config/config_schema_v3.2.json
@@ -244,6 +244,7 @@
{
"type": "object",
"required": ["type"],
+ "additionalProperties": false,
"properties": {
"type": {"type": "string"},
"source": {"type": "string"},
diff --git a/compose/config/config_schema_v3.3.json b/compose/config/config_schema_v3.3.json
index 96dc1d7d..efc0fdbd 100644
--- a/compose/config/config_schema_v3.3.json
+++ b/compose/config/config_schema_v3.3.json
@@ -278,6 +278,7 @@
{
"type": "object",
"required": ["type"],
+ "additionalProperties": false,
"properties": {
"type": {"type": "string"},
"source": {"type": "string"},
diff --git a/compose/config/config_schema_v3.4.json b/compose/config/config_schema_v3.4.json
index 8089c7e6..576ecfd8 100644
--- a/compose/config/config_schema_v3.4.json
+++ b/compose/config/config_schema_v3.4.json
@@ -282,6 +282,7 @@
{
"type": "object",
"required": ["type"],
+ "additionalProperties": false,
"properties": {
"type": {"type": "string"},
"source": {"type": "string"},
diff --git a/compose/config/config_schema_v3.5.json b/compose/config/config_schema_v3.5.json
index 6ccecbfd..d94b3feb 100644
--- a/compose/config/config_schema_v3.5.json
+++ b/compose/config/config_schema_v3.5.json
@@ -281,6 +281,7 @@
{
"type": "object",
"required": ["type"],
+ "additionalProperties": false,
"properties": {
"type": {"type": "string"},
"source": {"type": "string"},
diff --git a/tests/unit/config/config_test.py b/tests/unit/config/config_test.py
index 32ccf1ce..00ba6c2c 100644
--- a/tests/unit/config/config_test.py
+++ b/tests/unit/config/config_test.py
@@ -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):