Set the test url to the service endpoints when service_type

If the service_type, and thus gabbits directory, are in the
endpoints, then use the endpoint as the base url for the tests.
This commit is contained in:
Chris Dent 2017-07-30 20:26:11 +00:00
parent ead5d0d51a
commit 887bd69417
3 changed files with 19 additions and 12 deletions

View File

@ -46,10 +46,17 @@ class GenericGabbiTest(tempest.test.BaseTestCase):
name = '%s_SERVICE' % service_type.upper()
os.environ[name] = url
if cls.service_type in endpoints:
host = None
url = endpoints[cls.service_type]
else:
host = 'stub'
url = None
test_dir = os.path.join(os.path.dirname(__file__), 'gabbits',
cls.service_type)
cls.tests = driver.build_tests(
test_dir, unittest.TestLoader(), host='stub',
test_dir, unittest.TestLoader(), host=host, url=url,
test_loader_name='tempest.scenario.%s.%s' % (
cls.__name__, cls.service_type))

View File

@ -9,21 +9,21 @@ defaults:
tests:
- name: retrieve root
GET: $ENVIRON['COMPUTE_SERVICE']/
GET: /
response_json_paths:
# $NETLOC contains the /v2.1 prefix
$.version.links[?rel = "self"].href: /$ENVIRON['COMPUTE_SERVICE']/
$.version.status: CURRENT
- name: retrieve empty servers
GET: $ENVIRON['COMPUTE_SERVICE']/servers
GET: /servers
response_json_paths:
$.servers: []
- name: try bad accept
desc: https://bugs.launchpad.net/nova/+bug/1567966
xfail: True
GET: $ENVIRON['COMPUTE_SERVICE']/servers
GET: /servers
request_headers:
accept: text/plain
status: 406
@ -31,20 +31,20 @@ tests:
- name: try bad method
desc: https://bugs.launchpad.net/nova/+bug/1567970
xfail: True
DELETE: $ENVIRON['COMPUTE_SERVICE']/servers
DELETE: /servers
status: 405
- name: post bad content-type
desc: https://bugs.launchpad.net/nova/+bug/1567977
xfail: True
POST: $ENVIRON['COMPUTE_SERVICE']/servers
POST: /servers
request_headers:
content-type: text/plain
data: I want a server so badly
status: 415
- name: create server
POST: $ENVIRON['COMPUTE_SERVICE']/servers
POST: /servers
request_headers:
content-type: application/json
data:
@ -68,7 +68,7 @@ tests:
# bookmark link, whatever it is, is busted. Goes to bad version
# - name: get bookmark
# GET: $ENVIRON['COMPUTE_SERVICE']/$RESPONSE['$.server.links[?rel = "bookmark"].href']
# GET: $RESPONSE['$.server.links[?rel = "bookmark"].href']
- name: get server
GET: $RESPONSE['$.server.links[?rel = "self"].href']

View File

@ -9,7 +9,7 @@ defaults:
tests:
- name: retrieve root
GET: $ENVIRON['IMAGE_SERVICE']/
GET: /
status: 300
- name: choose current api
@ -18,16 +18,16 @@ tests:
GET: $RESPONSE['$.versions[?status = "CURRENT"].links[?rel = "self"].href']
- name: get images
GET: $ENVIRON['IMAGE_SERVICE']/v2/images
GET: /v2/images
- name: get one image
GET: $ENVIRON['IMAGE_SERVICE']$RESPONSE['$.images[0].self']
GET: $RESPONSE['$.images[0].self']
response_json_paths:
$.status: active
$.schema: /v2/schemas/image
- name: get the schema
GET: $ENVIRON['IMAGE_SERVICE']$RESPONSE['$.schema']
GET: $RESPONSE['$.schema']
response_json_paths:
$.name: image