Merge pull request #455 from shin-/prevent_invalid_resources

Update schemas to prevent invalid properties in deploy.resources
This commit is contained in:
Daniel Nephin 2017-08-18 11:42:39 -04:00 committed by GitHub
commit a8a3ffa8ef
7 changed files with 30 additions and 10 deletions

View File

@ -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

View File

@ -240,7 +240,8 @@
"properties": {
"limits": {"$ref": "#/definitions/resource"},
"reservations": {"$ref": "#/definitions/resource"}
}
},
"additionalProperties": false
},
"restart_policy": {
"type": "object",

View File

@ -269,7 +269,8 @@
"properties": {
"limits": {"$ref": "#/definitions/resource"},
"reservations": {"$ref": "#/definitions/resource"}
}
},
"additionalProperties": false
},
"restart_policy": {
"type": "object",

View File

@ -314,7 +314,8 @@
"properties": {
"limits": {"$ref": "#/definitions/resource"},
"reservations": {"$ref": "#/definitions/resource"}
}
},
"additionalProperties": false
},
"restart_policy": {
"type": "object",

View File

@ -348,7 +348,8 @@
"properties": {
"limits": {"$ref": "#/definitions/resource"},
"reservations": {"$ref": "#/definitions/resource"}
}
},
"additionalProperties": false
},
"restart_policy": {
"type": "object",

View File

@ -353,7 +353,8 @@
"properties": {
"limits": {"$ref": "#/definitions/resource"},
"reservations": {"$ref": "#/definitions/resource"}
}
},
"additionalProperties": false
},
"restart_policy": {
"type": "object",