Execute volume tests only when cinder is available

This change makes sure that the scenario tests which require cinder are
skipped when the [service_available] cinder option is False.

Change-Id: I94c48ecd28acadda39abf4ef794434a72e9a7002
This commit is contained in:
Takashi Kajinami 2022-08-21 11:37:20 +09:00
parent c4b871a79e
commit 40e4ff02b1
3 changed files with 17 additions and 0 deletions

View File

@ -109,6 +109,20 @@ 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)
conf = config.CONF.service_available
if not getattr(conf, service + '_enabled', True):
skipper = testtools.skip("%s is not available" % service)
return skipper(test_method)
return decorator
def requires_service_type(service_type):
'''Decorator for tests requiring a specific service being available.

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('volume')
class BasicResourcesTest(scenario_base.ScenarioTestsBase):
def setUp(self):

View File

@ -15,6 +15,7 @@ from cinderclient import exceptions as cinder_exceptions
import copy
from oslo_log import log as logging
import six
from tempest import config
from tempest.lib import decorators
from heat_tempest_plugin.common import exceptions
@ -25,6 +26,7 @@ LOG = logging.getLogger(__name__)
@test.requires_service_feature('volume', 'backup')
@test.requires_service('volume')
class VolumeBackupRestoreIntegrationTest(scenario_base.ScenarioTestsBase):
"""Class is responsible for testing of volume backup."""