Test for unsanitized consumer UUID

Add a gabbi test case demonstrating that the consumer with UUID
{8}-{4}-{4}-{4}-{12} is not the same as the consumer with UUID
{8}{4}{4}{4}{12}.

Change-Id: I1852ac6004fedc5dfa9dd3de187c937ab385d1b5
Related-Bug: #1758057
This commit is contained in:
Eric Fried 2018-07-09 16:06:37 -05:00 committed by Chris Dent
parent d3fa585f5e
commit a644b22056
1 changed files with 44 additions and 0 deletions

View File

@ -398,6 +398,50 @@ tests:
$.allocations.['1835b1c9-1c61-45af-9eb3-3e0e9f29487b'].resources.DISK_GB: 10
$.allocations.['1835b1c9-1c61-45af-9eb3-3e0e9f29487b'].resources.VCPU: 8
- name: put allocations on existing consumer with dashless UUID
PUT: /allocations/75d0f5f775d9458cb204f90ac91604ec
request_headers:
content-type: application/json
# Consumer generation
openstack-api-version: placement 1.28
data:
allocations:
fcfa516a-abbe-45d1-8152-d5225d82e596:
resources:
DISK_GB: 1
VCPU: 1
9229b2fc-d556-4e38-9c18-443e4bc6ceae:
resources:
DISK_GB: 1
VCPU: 1
# TODO(efried): Due to bug 1758057, this request is actually creating a
# *new* consumer; it should actually be replacing the allocations for the
# existing consumer with UUID 75d0f5f7-75d9-458c-b204-f90ac91604ec.
# consumer_generation: 3
consumer_generation: null
project_id: 00000000-0000-0000-0000-000000000000
user_id: 00000000-0000-0000-0000-000000000000
status: 204
- name: get allocations on existing consumer with dashed UUID
GET: /allocations/75d0f5f7-75d9-458c-b204-f90ac91604ec
response_json_paths:
# TODO(efried): Due to bug 1758057, these are the allocations from
# "put allocations on both those providers two". They *should* be from
# "put allocations on existing consumer with dashless UUID" instead.
# $.allocations.['fcfa516a-abbe-45d1-8152-d5225d82e596'].generation: 0
# $.allocations.['fcfa516a-abbe-45d1-8152-d5225d82e596'].resources.DISK_GB: 1
# $.allocations.['fcfa516a-abbe-45d1-8152-d5225d82e596'].resources.VCPU: 1
# $.allocations.['9229b2fc-d556-4e38-9c18-443e4bc6ceae'].generation: 0
# $.allocations.['9229b2fc-d556-4e38-9c18-443e4bc6ceae'].resources.DISK_GB: 1
# $.allocations.['9229b2fc-d556-4e38-9c18-443e4bc6ceae'].resources.VCPU: 1
$.allocations.['fcfa516a-abbe-45d1-8152-d5225d82e596'].generation: 4
$.allocations.['fcfa516a-abbe-45d1-8152-d5225d82e596'].resources.DISK_GB: 5
$.allocations.['fcfa516a-abbe-45d1-8152-d5225d82e596'].resources.VCPU: 4
$.allocations.['9229b2fc-d556-4e38-9c18-443e4bc6ceae'].generation: 4
$.allocations.['9229b2fc-d556-4e38-9c18-443e4bc6ceae'].resources.DISK_GB: 2
$.allocations.['9229b2fc-d556-4e38-9c18-443e4bc6ceae'].resources.VCPU: 8
- name: put an allocation for a not existing resource provider
PUT: /allocations/75d0f5f7-75d9-458c-b204-f90ac91604ec
request_headers: