[placement] Require at least one allocation when PUT
When doing a PUT to /allocations/{consumer_uuid} if the list of
allocations is empty there is a 500 error coming from an uncaught
IndexError.
Adjust the schema to require at least one allocation. If no allocations
are provided in the list, the response will be a 400.
This doesn't require a microversion because it is changing a 500 to
a useful response.
Change-Id: I361fa1e534d7b20c985558e272b672b84c6fe439
Closes-Bug: #1708260
(cherry picked from commit 9155da345e
)
This commit is contained in:
parent
e14fb63963
commit
c95cd011d0
|
@ -32,6 +32,7 @@ ALLOCATION_SCHEMA = {
|
|||
"properties": {
|
||||
"allocations": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
|
|
@ -48,6 +48,16 @@ tests:
|
|||
content-type: application/json
|
||||
status: 400
|
||||
|
||||
- name: put an allocation empty list
|
||||
PUT: /allocations/599ffd2d-526a-4b2e-8683-f13ad25f9958
|
||||
request_headers:
|
||||
content-type: application/json
|
||||
data:
|
||||
allocations: []
|
||||
status: 400
|
||||
response_strings:
|
||||
- "Failed validating 'minItems'"
|
||||
|
||||
- name: put an allocation violate schema
|
||||
PUT: /allocations/599ffd2d-526a-4b2e-8683-f13ad25f9958
|
||||
request_headers:
|
||||
|
|
Loading…
Reference in New Issue