Extract a generic gabbi class
Subclass of the generic class determine the service_type and service_name to be tested. The service_type drives the location of the gabbits. Note that nothing prevents loading gabbits from somewhere else and having multiple service types at play, this change is just a way to clarify options. The compute tests are moved into their own directory and some glance/image tests are added.
This commit is contained in:
parent
bf6f2c27c1
commit
0525a268fa
|
@ -20,18 +20,19 @@ import tempest.test
|
|||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class GenericGabbiTest(tempest.test.BaseTestCase):
|
||||
credentials = ['admin']
|
||||
# NOTE(cdent): WTF? 'nova' being the thing in service_available?
|
||||
# Boo!
|
||||
service_name = 'nova'
|
||||
service_type = 'compute'
|
||||
credentials = []
|
||||
service_name = None
|
||||
service_type = None
|
||||
|
||||
@classmethod
|
||||
def skip_checks(cls):
|
||||
service = cls.service_name
|
||||
super(GenericGabbiTest, cls).skip_checks()
|
||||
if not service:
|
||||
# FIXME(cdent): Hack to work around discoverability
|
||||
# weirdness
|
||||
raise cls.skipException('skipping the base class fake test')
|
||||
if not CONF.service_available.get(service):
|
||||
raise cls.skipException('%s support is required' % service)
|
||||
|
||||
|
@ -46,16 +47,15 @@ class GenericGabbiTest(tempest.test.BaseTestCase):
|
|||
if parsed_url.port:
|
||||
port = parsed_url.port
|
||||
|
||||
test_dir = os.path.join(os.path.dirname(__file__), 'gabbits')
|
||||
test_dir = os.path.join(os.path.dirname(__file__), 'gabbits',
|
||||
cls.service_type)
|
||||
cls.tests = driver.build_tests(
|
||||
test_dir, unittest.TestLoader(),
|
||||
host=host, port=port, prefix=prefix,
|
||||
test_loader_name='tempest.scenario.gabbi')
|
||||
test_loader_name='tempest.scenario.%s.%s' % (
|
||||
cls.__name__, cls.service_type))
|
||||
|
||||
os.environ["SERVICE_TOKEN"] = token
|
||||
# TODO(cdent): not very generic!
|
||||
os.environ['IMAGE_REF'] = CONF.compute.image_ref
|
||||
os.environ['FLAVOR_REF'] = CONF.compute.flavor_ref
|
||||
|
||||
@classmethod
|
||||
def clear_credentials(cls):
|
||||
|
@ -88,3 +88,24 @@ class GenericGabbiTest(tempest.test.BaseTestCase):
|
|||
# NOTE(sileht): A fake test is needed to have the class loaded
|
||||
# by the test runner
|
||||
pass
|
||||
|
||||
|
||||
class NovaGabbiTest(GenericGabbiTest):
|
||||
credentials = ['admin']
|
||||
# NOTE(cdent): WTF? 'nova' being the thing in service_available?
|
||||
# Boo!
|
||||
service_name = 'nova'
|
||||
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):
|
||||
credentials = ['admin']
|
||||
service_name = 'glance'
|
||||
service_type = 'image'
|
||||
|
|
|
@ -3,6 +3,9 @@ defaults:
|
|||
request_headers:
|
||||
x-auth-token: $ENVIRON['SERVICE_TOKEN']
|
||||
|
||||
# NOTE(cdent): The use of complex JSONPath to determine URLs is bad
|
||||
# for readability.
|
||||
|
||||
tests:
|
||||
|
||||
- name: retrieve root
|
|
@ -0,0 +1,34 @@
|
|||
|
||||
defaults:
|
||||
request_headers:
|
||||
x-auth-token: $ENVIRON['SERVICE_TOKEN']
|
||||
|
||||
# NOTE(cdent): The use of complex JSONPath to determine URLs is bad
|
||||
# for readability.
|
||||
|
||||
tests:
|
||||
|
||||
- name: retrieve root
|
||||
GET: /
|
||||
status: 300
|
||||
|
||||
- name: choose current api
|
||||
desc: apparently the /v2/ url is a 404, despite being right there in discovery
|
||||
xfail: true
|
||||
GET: $RESPONSE['$.versions[?status = "CURRENT"].links[?rel = "self"].href']
|
||||
|
||||
- name: get images
|
||||
GET: /v2/images
|
||||
|
||||
- name: get one image
|
||||
GET: $RESPONSE['$.images[0].self']
|
||||
response_json_paths:
|
||||
$.status: active
|
||||
$.schema: /v2/schemas/image
|
||||
|
||||
- name: get the schema
|
||||
GET: $RESPONSE['$.schema']
|
||||
response_json_paths:
|
||||
$.name: image
|
||||
|
||||
# TODO(cdent): add some images
|
Loading…
Reference in New Issue