Merge "Execute volume tests only when cinder is available"

This commit is contained in:
Zuul 2024-01-09 02:24:53 +00:00 committed by Gerrit Code Review
commit 6a491bded3
3 changed files with 19 additions and 1 deletions

View File

@ -108,6 +108,22 @@ def requires_resource_type(resource_type):
return decorator
def requires_service(service):
'''Decorator for tests requiring a specific service being available.
The decorated test will be skipped when a service is not available. This
based on the [service_available] options implemented in tempest
'''
def decorator(test_method):
if not getattr(config.CONF.service_available, service, True):
skipper = testtools.skip(
"%s service not available, skipping test." % service)
return skipper(test_method)
else:
return test_method
return decorator
def requires_service_type(service_type):
'''Decorator for tests requiring a specific service being available.
@ -124,7 +140,7 @@ def requires_service_type(service_type):
service_type, conf.region, conf.endpoint_type)
except kc_exceptions.EndpointNotFound:
skipper = testtools.skip(
"%s service not available, skipping test." % service_type)
"%s service type not available, skipping test." % service_type)
return skipper(test_method)
else:
return test_method

View File

@ -17,6 +17,7 @@ from heat_tempest_plugin.common import test
from heat_tempest_plugin.tests.scenario import scenario_base
@test.requires_service('cinder')
class BasicResourcesTest(scenario_base.ScenarioTestsBase):
def setUp(self):

View File

@ -24,6 +24,7 @@ LOG = logging.getLogger(__name__)
@test.requires_service_feature('volume', 'backup')
@test.requires_service('cinder')
class VolumeBackupRestoreIntegrationTest(scenario_base.ScenarioTestsBase):
"""Class is responsible for testing of volume backup."""