Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
172 lines (145 sloc) 5.12 KB
defaults:
request_headers:
x-auth-token: $ENVIRON['SERVICE_TOKEN']
content-type: application/json
accept: application/json
openstack-api-version: 'compute latest, placement latest'
# These replace full nodes, there is no YAML interpolation
# Experimenting with using YAML anchors to avoid repeating long expansions
# within the tests.
vars:
- &cn1_rp $ENVIRON['PLACEMENT_SERVICE']/resource_providers/$HISTORY['list hypervisors'].$RESPONSE['$.hypervisors[0].id']
- &cn1_inv $ENVIRON['PLACEMENT_SERVICE']/resource_providers/$HISTORY['list hypervisors'].$RESPONSE['$.hypervisors[0].id']/inventories
- &cn1_alloc $ENVIRON['PLACEMENT_SERVICE']/resource_providers/$HISTORY['list hypervisors'].$RESPONSE['$.hypervisors[0].id']/allocations
- &cn1_usages $ENVIRON['PLACEMENT_SERVICE']/resource_providers/$HISTORY['list hypervisors'].$RESPONSE['$.hypervisors[0].id']/usages
- &s1_url $ENVIRON['COMPUTE_SERVICE']/servers/$HISTORY['get server'].$RESPONSE['$.server.id']
- &s1_action $ENVIRON['COMPUTE_SERVICE']/servers/$HISTORY['get server'].$RESPONSE['$.server.id']/action
- &s1_alloc $ENVIRON['PLACEMENT_SERVICE']/allocations/$HISTORY['get server'].$RESPONSE['$.server.id']
- &image_id $HISTORY['get image ref'].$RESPONSE['$.images[0].id']
# quotes are weird in yaml, they act as pairs so escaping should not be needed in the following
- &flavor_id $HISTORY['get flavor ref'].$RESPONSE['$.flavors[?name = "$ENVIRON['FLAVOR_NAME']"].id']
- &flavor_id_alt $HISTORY['get flavor ref'].$RESPONSE['$.flavors[?name = "$ENVIRON['FLAVOR_NAME_ALT']"].id']
tests:
- name: list hypervisors
GET: $ENVIRON['COMPUTE_SERVICE']/os-hypervisors
response_json_paths:
$.hypervisors.`len`: 1
- name: confirm resource provider
GET: *cn1_rp
response_json_paths:
$.uuid: $RESPONSE['$.hypervisors[0].id']
- name: get image ref
GET: $ENVIRON['IMAGE_SERVICE']/v2/images?name=$ENVIRON['IMAGE_NAME']
response_json_paths:
$.images[0].name: $ENVIRON['IMAGE_NAME']
- name: get flavor ref
GET: $ENVIRON['COMPUTE_SERVICE']/flavors
response_json_paths:
# This can't be anything but true if the flavor exists, but it helps with
# writing the test.
$.flavors[?name = "$ENVIRON['FLAVOR_NAME']"].name: $ENVIRON['FLAVOR_NAME']
- name: confirm inventory
GET: *cn1_inv
response_json_paths:
$.inventories.VCPU.allocation_ratio: 16
- &cn1_zero
name: confirm empty allocation
GET: *cn1_alloc
response_json_paths:
$.allocations.`len`: 0
- name: create server
POST: $ENVIRON['COMPUTE_SERVICE']/servers
data:
server:
name: new-server-one
networks: auto
imageRef: *image_id
flavorRef: *flavor_id
status: 202
- name: get server
GET: $LOCATION
- name: watch allocations
GET: *s1_alloc
poll:
count: 4
delay: 1
response_json_paths:
$.allocations.["$HISTORY['list hypervisors'].$RESPONSE['$.hypervisors[0].id']"].resources:
VCPU: 1
MEMORY_MB: 64
- name: server active
GET: *s1_url
poll:
count: 10
delay: 2
response_json_paths:
$.server.status: ACTIVE
- name: resize server
POST: *s1_action
data:
resize:
flavorRef: *flavor_id_alt
OS-DCF:diskConfig: AUTO
status: 202
- name: wait for verify resize
GET: *s1_url
poll:
count: 12
delay: 5
response_json_paths:
$.server.status: VERIFY_RESIZE
# expected to fail because we don't double this way anymore
- name: check for double allocations
xfail: True
GET: *s1_alloc
poll:
count: 10
delay: 1
response_json_paths:
$.allocations.["$HISTORY['list hypervisors'].$RESPONSE['$.hypervisors[0].id']"].resources:
VCPU: 2
MEMORY_MB: 192
- name: confirm usages pending
GET: *cn1_usages
response_json_paths:
$.usages:
DISK_GB: 0
MEMORY_MB: 192
VCPU: 2
- name: confirm resize
POST: *s1_action
data:
confirmResize: null
status: 204
- name: wait for active
GET: *s1_url
poll:
count: 12
delay: 5
response_json_paths:
$.server.status: ACTIVE
- name: changed to correct allocations
GET: *s1_alloc
poll:
count: 12
delay: 5
response_json_paths:
$.allocations.["$HISTORY['list hypervisors'].$RESPONSE['$.hypervisors[0].id']"].resources:
VCPU: 1
MEMORY_MB: 128
- name: confirm usages active
GET: *cn1_usages
response_json_paths:
$.usages:
DISK_GB: 0
MEMORY_MB: 128
VCPU: 1
### Clean Up
- name: delete server
DELETE: *s1_url
status: 204
- name: reconfirm empty allocation
<<: *cn1_zero
poll:
count: 12
delay: 5