Adds a test for getting allocations API

`GET /resource_provider/{uuid}/allocations` API currently doesn't
return all the allocations made by multiple users.

This patch adds a test to describe this bug. The fix for this
is coming in a follow up.

Change-Id: I2b01e27922f11bef2defcb01fe415692de1578ea
Partial-Bug: #1785382
This commit is contained in:
Tetsuro Nakamura 2018-08-04 18:38:20 +09:00
parent 7d824e6d37
commit 9cfc598acf
2 changed files with 19 additions and 0 deletions

View File

@ -166,6 +166,7 @@ class AllocationFixture(APIFixture):
# Create a first consumer for the DISK_GB allocations
consumer1 = tb.ensure_consumer(self.context, user, project)
tb.set_allocation(self.context, rp, consumer1, {'DISK_GB': 1000})
os.environ['CONSUMER_0'] = consumer1.uuid
# Create a second consumer for the VCPU allocations
consumer2 = tb.ensure_consumer(self.context, user, project)

View File

@ -25,6 +25,24 @@ tests:
$.usages.DISK_GB: 1020
$.usages.VCPU: 7
- name: get allocations
GET: /resource_providers/$ENVIRON['RP_UUID']/allocations
response_headers:
content-type: /application/json/
response_json_paths:
# Bug#1785382: It doesn't show all the consumers
# on the resource provider
# $.allocations.`len`: 3
$.allocations.`len`: 2
$.allocations["$ENVIRON['CONSUMER_0']"].resources:
DISK_GB: 1000
$.allocations["$ENVIRON['CONSUMER_ID']"].resources:
VCPU: 6
# $.allocations["$ENVIRON['ALT_CONSUMER_ID']"].resources:
# VCPU: 1
# DISK_GB: 20
$.resource_provider_generation: 5
- name: fail to delete resource provider
DELETE: /resource_providers/$ENVIRON['RP_UUID']
status: 409