Fix typo in schema

We should have been specifying a minimum number of properties for the
'mappings' field when creating allocations [1]. We were not, thanks to a
typo. Correct this typo.

[1] https://docs.openstack.org/api-ref/placement/#allocations

Change-Id: I79bd5bf36a57983c38abc9235a8420931f373ca4
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane 2022-07-11 13:00:07 +01:00
parent d723f225c1
commit 7d4d49f41c
3 changed files with 23 additions and 3 deletions

View File

@ -172,7 +172,7 @@ POST_ALLOCATIONS_V1_28["patternProperties"] = {
# request group suffixes with lists of resource provider uuids. # request group suffixes with lists of resource provider uuids.
mappings_schema = { mappings_schema = {
"type": "object", "type": "object",
"minProperites": 1, "minProperties": 1,
"patternProperties": { "patternProperties": {
common.GROUP_PAT_1_33: { common.GROUP_PAT_1_33: {
"type": "array", "type": "array",

View File

@ -70,8 +70,19 @@ tests:
project_id: b2e599e0-ded8-47fd-b8ab-ceb7fca578bd project_id: b2e599e0-ded8-47fd-b8ab-ceb7fca578bd
status: 400 status: 400
response_json_paths: response_json_paths:
# u? accounts for difference in Python 2.7 v. 3.x response $.errors[0].detail: "/JSON does not validate: 'beta' is not of type 'array'/"
$.errors[0].detail: "/JSON does not validate: u?'beta' is not of type 'array'/"
- name: put allocation mapping empty
PUT: /allocations/5f9588de-079d-462a-a459-408524ab9b60
data:
allocations: $HISTORY['mappings request'].$RESPONSE['$.allocation_requests[0].allocations']
mappings: {}
consumer_generation: null
user_id: 8c974f9a-f266-42f7-8613-a8017cbfb87F
project_id: b2e599e0-ded8-47fd-b8ab-ceb7fca578bd
status: 400
response_json_paths:
$.errors[0].detail: "/JSON does not validate: {} does not have enough properties/"
- name: post allocation with results - name: post allocation with results
POST: /allocations POST: /allocations

View File

@ -0,0 +1,9 @@
---
fixes:
- |
Since microversion 1.34, it has been possible to provide a ``mappings``
field when creating new allocations via the ``POST /allocations`` or ``PUT
/allocations/{allocation_id}`` APIs. This field should be a a dictionary
associating request group suffixes with a list of UUIDs identifying the
resource providers that satisfied each group. Due to a typo, this was
allowing an empty object (``{}``). This is now corrected.