Prove out multi-endpoint testing

multi/base.yaml looks at both the compute and placement services,
confirming that the one hypervisor that exists has a resource
provider with inventory with a proper allocation ratio for VCPU.

It turns out that each of the <TYPE>_SERVICE ENVIRON variables also
needs a <TYPE>_BASE otherwise it can be hard to reconstruct URLs
using links in respones. Sometimes they are full hosts. Sometimes
they are absolute URLs. Neither of this can be appended to a fully
qualified endpoint.
This commit is contained in:
Chris Dent 2017-07-30 21:40:38 +00:00
parent e3e2912b80
commit d456bd7607
2 changed files with 34 additions and 0 deletions

View File

@ -46,6 +46,8 @@ class GenericGabbiTest(tempest.test.BaseTestCase):
for service_type, url in endpoints.items():
name = '%s_SERVICE' % service_type.upper()
os.environ[name] = url
name = '%s_BASE' % service_type.upper()
os.environ[name] = '://'.join(urlparse.urlparse(url)[0:2])
os.environ['SERVICE_TOKEN'] = token
if cls.service_type in endpoints:
@ -120,3 +122,9 @@ class GlanceGabbiTest(GenericGabbiTest):
credentials = ['admin']
service_name = 'glance'
service_type = 'image'
class PlacementNovaGabbiTest(GenericGabbiTest):
credentials = ['admin']
service_name = 'nova'
service_type = 'multi'

View File

@ -0,0 +1,26 @@
defaults:
request_headers:
x-auth-token: $ENVIRON['SERVICE_TOKEN']
content-type: application/json
accept: application/json
openstack-api-version: 'compute latest, placement latest'
tests:
- name: list hypervisors
GET: $ENVIRON['COMPUTE_SERVICE']/os-hypervisors
response_json_paths:
$.hypervisors.`len`: 1
- name: confirm resource provider
GET: $ENVIRON['PLACEMENT_SERVICE']/resource_providers/$RESPONSE['$.hypervisors[0].id']
response_json_paths:
$.uuid: $RESPONSE['$.hypervisors[0].id']
- name: blargh inventory
verbose: True
GET: $ENVIRON['PLACEMENT_BASE']$RESPONSE['$.links[?rel=inventories].href']
response_json_paths:
$.inventories.VCPU.allocation_ratio: 16