mirror of https://github.com/docker/cli.git
Update schemas to prevent invalid properties in deploy.resources
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
e57842edb8
commit
1667073908
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue