mirror of https://github.com/docker/cli.git
Merge pull request #455 from shin-/prevent_invalid_resources
Update schemas to prevent invalid properties in deploy.resources
This commit is contained in:
commit
a8a3ffa8ef
|
@ -584,6 +584,21 @@ services:
|
||||||
assert.Contains(t, forbidden, "extends")
|
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) {
|
func TestInvalidExternalAndDriverCombination(t *testing.T) {
|
||||||
_, err := loadYAML(`
|
_, err := loadYAML(`
|
||||||
version: "3"
|
version: "3"
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -240,7 +240,8 @@
|
||||||
"properties": {
|
"properties": {
|
||||||
"limits": {"$ref": "#/definitions/resource"},
|
"limits": {"$ref": "#/definitions/resource"},
|
||||||
"reservations": {"$ref": "#/definitions/resource"}
|
"reservations": {"$ref": "#/definitions/resource"}
|
||||||
}
|
},
|
||||||
|
"additionalProperties": false
|
||||||
},
|
},
|
||||||
"restart_policy": {
|
"restart_policy": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
|
|
@ -269,7 +269,8 @@
|
||||||
"properties": {
|
"properties": {
|
||||||
"limits": {"$ref": "#/definitions/resource"},
|
"limits": {"$ref": "#/definitions/resource"},
|
||||||
"reservations": {"$ref": "#/definitions/resource"}
|
"reservations": {"$ref": "#/definitions/resource"}
|
||||||
}
|
},
|
||||||
|
"additionalProperties": false
|
||||||
},
|
},
|
||||||
"restart_policy": {
|
"restart_policy": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
|
|
@ -314,7 +314,8 @@
|
||||||
"properties": {
|
"properties": {
|
||||||
"limits": {"$ref": "#/definitions/resource"},
|
"limits": {"$ref": "#/definitions/resource"},
|
||||||
"reservations": {"$ref": "#/definitions/resource"}
|
"reservations": {"$ref": "#/definitions/resource"}
|
||||||
}
|
},
|
||||||
|
"additionalProperties": false
|
||||||
},
|
},
|
||||||
"restart_policy": {
|
"restart_policy": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
|
|
@ -348,7 +348,8 @@
|
||||||
"properties": {
|
"properties": {
|
||||||
"limits": {"$ref": "#/definitions/resource"},
|
"limits": {"$ref": "#/definitions/resource"},
|
||||||
"reservations": {"$ref": "#/definitions/resource"}
|
"reservations": {"$ref": "#/definitions/resource"}
|
||||||
}
|
},
|
||||||
|
"additionalProperties": false
|
||||||
},
|
},
|
||||||
"restart_policy": {
|
"restart_policy": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
|
|
@ -353,7 +353,8 @@
|
||||||
"properties": {
|
"properties": {
|
||||||
"limits": {"$ref": "#/definitions/resource"},
|
"limits": {"$ref": "#/definitions/resource"},
|
||||||
"reservations": {"$ref": "#/definitions/resource"}
|
"reservations": {"$ref": "#/definitions/resource"}
|
||||||
}
|
},
|
||||||
|
"additionalProperties": false
|
||||||
},
|
},
|
||||||
"restart_policy": {
|
"restart_policy": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
|
Loading…
Reference in New Issue