Merge "Adds a test for getting allocations API"

This commit is contained in:
Zuul 2018-08-07 00:50:17 +00:00 committed by Gerrit Code Review
commit 1d97b663d3
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