Add API tests for List and Get Allocation API

This patch adds API tests for List and Get host allocation API.

Partially Implements: blueprint resource-allocation-api
Change-Id: I597e163541776022c1152cab02f259c857b1a459
This commit is contained in:
Masahito Muroi 2018-07-29 15:54:02 +09:00 committed by Pierre Riteau
parent b719662d91
commit a661ec479f
1 changed files with 71 additions and 0 deletions

View File

@ -0,0 +1,71 @@
fixtures:
- AuthenticationFixture
defaults:
request_headers:
accept: application/json
content-type: application/json
X-Auth-Token: $ENVIRON['OS_TOKEN']
tests:
- name: get host name
GET: compute/v2.1/os-hypervisors
status: 200
- name: post new host
POST: reservation/v1/os-hosts
data:
name: $HISTORY['get host name'].$RESPONSE['$.hypervisors[0].hypervisor_hostname']
status: 201
- name: post new lease lease1
POST: reservation/v1/leases
data:
name: lease1
start_date: "2020-01-01 10:00"
end_date: "2020-01-01 11:00"
reservations:
- resource_type: physical:host
min: 1
max: 1
hypervisor_properties: "[]"
resource_properties: "[]"
status: 201
- name: post new lease lease2
POST: reservation/v1/leases
data:
name: lease2
start_date: "2020-01-01 12:00"
end_date: "2020-01-01 13:00"
reservations:
- resource_type: physical:host
min: 1
max: 1
hypervisor_properties: "[]"
resource_properties: "[]"
status: 201
- name: list host allocations
GET: reservation/v1/os-hosts/allocations
response_json_paths:
$.allocations..reservations.`len`: 2
- name: list host allocations with lease2
GET: reservation/v1/os-hosts/allocations
query_parameters:
lease_id: $HISTORY['post new lease lease2'].$RESPONSE['$.lease.id']
response_json_paths:
$.allocations.`len`: 1
- name: delete lease2
DELETE: reservation/v1/leases/$HISTORY['post new lease lease2'].$RESPONSE['$.lease.id']
status: 204
- name: delete lease1
DELETE: reservation/v1/leases/$HISTORY['post new lease lease1'].$RESPONSE['$.lease.id']
status: 204
- name: delete host
DELETE: reservation/v1/os-hosts/$HISTORY['post new host'].$RESPONSE['$.host.id']
status: 204