From eb19ad160a9bdd33eb56eb132856a063bc04485f Mon Sep 17 00:00:00 2001 From: Andrea Frittoli Date: Fri, 28 Jul 2017 22:00:18 +0100 Subject: [PATCH] Handle available volume client versions If Cinder is not available or Cinder v1 only is available skip volume attachment tests. Else prefer volume v3 where available or fallback to v2 otherwise. This requires a Tempest patch for the snapshots v3 client. Change-Id: If3b6a2c71498c19a0a8dfeb4c51e2c80e5a918f4 Depends-on: I21f07f7b3e8f22055e7978c0bf4aa01b80b493d9 --- .../scenario/application_catalog/base.py | 3 --- .../test_cinder_volumes.py | 24 +++++++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/murano_tempest_tests/tests/scenario/application_catalog/base.py b/murano_tempest_tests/tests/scenario/application_catalog/base.py index 596cdc2..3eb1c5e 100644 --- a/murano_tempest_tests/tests/scenario/application_catalog/base.py +++ b/murano_tempest_tests/tests/scenario/application_catalog/base.py @@ -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 diff --git a/murano_tempest_tests/tests/scenario/application_catalog/test_cinder_volumes.py b/murano_tempest_tests/tests/scenario/application_catalog/test_cinder_volumes.py index e07c124..b3b42cd 100644 --- a/murano_tempest_tests/tests/scenario/application_catalog/test_cinder_volumes.py +++ b/murano_tempest_tests/tests/scenario/application_catalog/test_cinder_volumes.py @@ -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: