Update schemas to prevent invalid properties in deploy.resources

Signed-off-by: Joffrey F <joffrey@docker.com>
Upstream-commit: 1667073908
Component: cli
This commit is contained in:
Joffrey F
2017-08-17 15:58:51 -07:00
parent 04e18204b0
commit 6092fc343f
7 changed files with 30 additions and 10 deletions
@@ -584,6 +584,21 @@ services:
assert.Contains(t, forbidden, "extends")
}
func TestInvalidResource(t *testing.T) {
_, err := loadYAML(`
version: "3"
services:
foo:
image: busybox
deploy:
resources:
impossible:
x: 1
`)
assert.Error(t, err)
assert.Contains(t, err.Error(), "Additional property impossible is not allowed")
}
func TestInvalidExternalAndDriverCombination(t *testing.T) {
_, err := loadYAML(`
version: "3"
File diff suppressed because one or more lines are too long
@@ -240,7 +240,8 @@
"properties": {
"limits": {"$ref": "#/definitions/resource"},
"reservations": {"$ref": "#/definitions/resource"}
}
},
"additionalProperties": false
},
"restart_policy": {
"type": "object",
@@ -269,7 +269,8 @@
"properties": {
"limits": {"$ref": "#/definitions/resource"},
"reservations": {"$ref": "#/definitions/resource"}
}
},
"additionalProperties": false
},
"restart_policy": {
"type": "object",
@@ -314,7 +314,8 @@
"properties": {
"limits": {"$ref": "#/definitions/resource"},
"reservations": {"$ref": "#/definitions/resource"}
}
},
"additionalProperties": false
},
"restart_policy": {
"type": "object",
@@ -348,7 +348,8 @@
"properties": {
"limits": {"$ref": "#/definitions/resource"},
"reservations": {"$ref": "#/definitions/resource"}
}
},
"additionalProperties": false
},
"restart_policy": {
"type": "object",
@@ -353,7 +353,8 @@
"properties": {
"limits": {"$ref": "#/definitions/resource"},
"reservations": {"$ref": "#/definitions/resource"}
}
},
"additionalProperties": false
},
"restart_policy": {
"type": "object",