From a661ec479f719af31bcf9c7a1c03cac16178fa80 Mon Sep 17 00:00:00 2001 From: Masahito Muroi Date: Sun, 29 Jul 2018 15:54:02 +0900 Subject: [PATCH] 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 --- .../tests/api/gabbits/allocations.yaml | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 blazar_tempest_plugin/tests/api/gabbits/allocations.yaml diff --git a/blazar_tempest_plugin/tests/api/gabbits/allocations.yaml b/blazar_tempest_plugin/tests/api/gabbits/allocations.yaml new file mode 100644 index 0000000..5640c75 --- /dev/null +++ b/blazar_tempest_plugin/tests/api/gabbits/allocations.yaml @@ -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