Merge "Handle available volume client versions"

This commit is contained in:
Jenkins 2017-08-01 16:53:08 +00:00 committed by Gerrit Code Review
commit c9876c965f
2 changed files with 24 additions and 3 deletions

View File

@ -58,9 +58,6 @@ class BaseApplicationCatalogScenarioTest(test.BaseTestCase):
params = config.service_client_config('orchestration')
cls.orchestration_client = orchestration.OrchestrationClient(
cls.services_manager.auth_provider, **params)
cls.snapshots_client = cls.services_manager.snapshots_v2_client
cls.volumes_client = cls.services_manager.volumes_v2_client
cls.backups_client = cls.services_manager.backups_v2_client
cls.images_client = cls.services_manager.image_client_v2
@classmethod

View File

@ -26,6 +26,30 @@ CONF = config.CONF
class TestCinderVolumes(base.BaseApplicationCatalogScenarioTest):
@classmethod
def skip_checks(cls):
super(TestCinderVolumes, cls).skip_checks()
if not CONF.service_available.cinder:
msg = "Cinder is not available. Skipping volumes attachment tests"
raise cls.skipException(msg)
if (not CONF.volume_feature_enabled.api_v3 and
not CONF.volume_feature_enabled.api_v2):
msg = ("Neither cinder v2 nor v3 are not available. Skipping"
"volumes attachment tests")
raise cls.skipException(msg)
@classmethod
def setup_clients(cls):
super(TestCinderVolumes, cls).setup_clients()
# Prefer volume v3 which is the current version
if CONF.volume_feature_enabled.api_v3:
_volume = cls.services_manager.volume_v3
elif CONF.volume_feature_enabled.api_v2:
_volume = cls.services_manager.volume_v2
cls.volumes_client = _volume.VolumesClient()
cls.backups_client = _volume.BackupsClient()
cls.snapshots_client = _volume.SnapshotsClient()
@classmethod
def resource_setup(cls):
if not CONF.application_catalog.cinder_volume_tests: