Establish a basic create/delete server arc
Move around some ENVIRON so that we always have the expected values in the tests (it's cheap so why not?). multi/base.yaml tries to take advantage of YAML anchors to avoid repeating some of the longer substitutions[1] but I'm not sure if it is going to be the right thing. Next: do a resize. [1] https://gabbi.readthedocs.io/en/latest/format.html#substitution
This commit is contained in:
parent
d456bd7607
commit
e1cbf59fee
|
@ -49,6 +49,8 @@ class GenericGabbiTest(tempest.test.BaseTestCase):
|
||||||
name = '%s_BASE' % service_type.upper()
|
name = '%s_BASE' % service_type.upper()
|
||||||
os.environ[name] = '://'.join(urlparse.urlparse(url)[0:2])
|
os.environ[name] = '://'.join(urlparse.urlparse(url)[0:2])
|
||||||
os.environ['SERVICE_TOKEN'] = token
|
os.environ['SERVICE_TOKEN'] = token
|
||||||
|
os.environ['IMAGE_REF'] = CONF.compute.image_ref
|
||||||
|
os.environ['FLAVOR_REF'] = CONF.compute.flavor_ref
|
||||||
|
|
||||||
if cls.service_type in endpoints:
|
if cls.service_type in endpoints:
|
||||||
host = None
|
host = None
|
||||||
|
@ -105,18 +107,9 @@ class GenericGabbiTest(tempest.test.BaseTestCase):
|
||||||
|
|
||||||
class NovaGabbiTest(GenericGabbiTest):
|
class NovaGabbiTest(GenericGabbiTest):
|
||||||
credentials = ['admin']
|
credentials = ['admin']
|
||||||
# NOTE(cdent): WTF? 'nova' being the thing in service_available?
|
|
||||||
# Boo!
|
|
||||||
service_name = 'nova'
|
service_name = 'nova'
|
||||||
service_type = 'compute'
|
service_type = 'compute'
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def resource_setup(cls):
|
|
||||||
super(NovaGabbiTest, cls).resource_setup()
|
|
||||||
# TODO(cdent): not very generic!
|
|
||||||
os.environ['IMAGE_REF'] = CONF.compute.image_ref
|
|
||||||
os.environ['FLAVOR_REF'] = CONF.compute.flavor_ref
|
|
||||||
|
|
||||||
|
|
||||||
class GlanceGabbiTest(GenericGabbiTest):
|
class GlanceGabbiTest(GenericGabbiTest):
|
||||||
credentials = ['admin']
|
credentials = ['admin']
|
||||||
|
|
|
@ -6,6 +6,19 @@ defaults:
|
||||||
accept: application/json
|
accept: application/json
|
||||||
openstack-api-version: 'compute latest, placement latest'
|
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_id $HISTORY['get server'].$RESPONSE['$.server.id']
|
||||||
|
- &s1_url $ENVIRON['COMPUTE_SERVICE']/servers/$HISTORY['get server'].$RESPONSE['$.server.id']
|
||||||
|
- &s1_alloc $ENVIRON['PLACEMENT_SERVICE']/allocations/$HISTORY['get server'].$RESPONSE['$.server.id']
|
||||||
|
|
||||||
tests:
|
tests:
|
||||||
|
|
||||||
- name: list hypervisors
|
- name: list hypervisors
|
||||||
|
@ -18,9 +31,50 @@ tests:
|
||||||
response_json_paths:
|
response_json_paths:
|
||||||
$.uuid: $RESPONSE['$.hypervisors[0].id']
|
$.uuid: $RESPONSE['$.hypervisors[0].id']
|
||||||
|
|
||||||
- name: blargh inventory
|
- name: confirm inventory
|
||||||
verbose: True
|
GET: *cn1_inv
|
||||||
GET: $ENVIRON['PLACEMENT_BASE']$RESPONSE['$.links[?rel=inventories].href']
|
|
||||||
response_json_paths:
|
response_json_paths:
|
||||||
$.inventories.VCPU.allocation_ratio: 16
|
$.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: $ENVIRON['IMAGE_REF']
|
||||||
|
flavorRef: $ENVIRON['FLAVOR_REF']
|
||||||
|
status: 202
|
||||||
|
|
||||||
|
- name: get server
|
||||||
|
GET: $LOCATION
|
||||||
|
|
||||||
|
- name: watch allocations
|
||||||
|
verbose: True
|
||||||
|
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
|
||||||
|
|
||||||
|
### Clean Up
|
||||||
|
|
||||||
|
- name: delete server
|
||||||
|
DELETE: *s1_url
|
||||||
|
status: 204
|
||||||
|
|
||||||
|
- name: reconfirm empty allocation
|
||||||
|
<<: *cn1_zero
|
||||||
|
verbose: True
|
||||||
|
poll:
|
||||||
|
count: 10
|
||||||
|
delay: 1
|
||||||
|
|
Loading…
Reference in New Issue