nova/nova/tests/functional/api/openstack/placement/gabbits/with-allocations.yaml

116 lines
3.4 KiB
YAML

fixtures:
- AllocationFixture
defaults:
request_headers:
x-auth-token: admin
tests:
- name: confirm inventories
GET: /resource_providers/$ENVIRON['RP_UUID']/inventories
response_json_paths:
$.inventories.DISK_GB.total: 2048
$.inventories.DISK_GB.reserved: 0
- name: get usages
GET: /resource_providers/$ENVIRON['RP_UUID']/usages
response_headers:
# use a regex here because charset, which is not only not
# required but superfluous, is present
content-type: /application/json/
response_json_paths:
$.resource_provider_generation: 5
$.usages.DISK_GB: 1020
$.usages.VCPU: 7
- name: fail to delete resource provider
DELETE: /resource_providers/$ENVIRON['RP_UUID']
status: 409
response_strings:
- "Unable to delete resource provider $ENVIRON['RP_UUID']: Resource provider has allocations."
- name: fail to change inventory via put 1.23
PUT: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
accept: application/json
content-type: application/json
openstack-api-version: placement 1.23
data:
resource_provider_generation: 5
inventories: {}
status: 409
response_json_paths:
$.errors[0].code: placement.inventory.inuse
- name: fail to delete all inventory
DELETE: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
accept: application/json
openstack-api-version: placement 1.5
status: 409
response_headers:
content-type: /application/json/
response_strings:
- "Inventory for 'VCPU, DISK_GB' on resource provider '$ENVIRON['RP_UUID']' in use"
- name: get total usages by project
GET: /usages?project_id=$ENVIRON['PROJECT_ID']
request_headers:
openstack-api-version: placement 1.9
status: 200
response_json_paths:
$.usages.DISK_GB: 1020
$.usages.VCPU: 7
- name: get total usages by project and user
GET: /usages?project_id=$ENVIRON['PROJECT_ID']&user_id=$ENVIRON['USER_ID']
request_headers:
openstack-api-version: placement 1.9
status: 200
response_json_paths:
$.usages.DISK_GB: 1000
$.usages.VCPU: 6
- name: get total usages by project and alt user
GET: /usages?project_id=$ENVIRON['PROJECT_ID']&user_id=$ENVIRON['ALT_USER_ID']
request_headers:
openstack-api-version: placement 1.9
status: 200
# In pre 1.15 microversions cache headers not present
response_forbidden_headers:
- last-modified
- cache-control
response_json_paths:
$.usages.DISK_GB: 20
$.usages.VCPU: 1
- name: get allocations without project and user
GET: /allocations/$ENVIRON['CONSUMER_ID']
request_headers:
openstack-api-version: placement 1.11
accept: application/json
response_json_paths:
# only one key in the top level object
$.`len`: 1
- name: get allocations with project and user
GET: /allocations/$ENVIRON['CONSUMER_ID']
request_headers:
openstack-api-version: placement 1.12
accept: application/json
response_json_paths:
$.project_id: $ENVIRON['PROJECT_ID']
$.user_id: $ENVIRON['USER_ID']
$.`len`: 3
- name: get total usages with cache headers
GET: /usages?project_id=$ENVIRON['PROJECT_ID']&user_id=$ENVIRON['ALT_USER_ID']
request_headers:
openstack-api-version: placement 1.15
response_headers:
cache-control: no-cache
# Does last-modified look like a legit timestamp?
last-modified: /^\w+, \d+ \w+ \d{4} [\d:]+ GMT$/