Skip scenario tests early to avoid unnecessary setup

This is change for the volume scenario test to
skip them early.

When we skip the test class using skip_checks(), it check
the conditions and skip the test class at first step
without creating any keystone credentials. But when
tests are skipped with other decorator at test level then
it does create keystone credentials, setup network resources
and service clients.

This will mostly help neutron gate where these volume
tests will be skipped in the initial stage only and will
not create the keystone and network resources.

One good example is TestEncryptedCinderVolumes which is skipped
 - https://zuul.openstack.org/build/babcc06f24764a408ed77702365b4c5b/log/job-output.txt#28695

But it still does the resources setup
- https://zuul.openstack.org/build/babcc06f24764a408ed77702365b4c5b/log/controller/logs/tempest_log.txt#6374-6450

Related-Bug: #2004780
Change-Id: I59cd39c20b995bf2ed2f58f4522743c3ca51b516
This commit is contained in:
Ghanshyam Mann 2023-08-04 12:11:59 -07:00 committed by Ghanshyam
parent fd90dacc8e
commit 2803b57d6c
6 changed files with 25 additions and 0 deletions

View File

@ -38,6 +38,12 @@ class TestMinimumBasicScenario(manager.ScenarioTest):
* check command outputs
"""
@classmethod
def skip_checks(cls):
super(TestMinimumBasicScenario, cls).skip_checks()
if not CONF.service_available.cinder:
raise cls.skipException("Cinder is not available")
def nova_show(self, server):
got_server = (self.servers_client.show_server(server['id'])
['server'])

View File

@ -26,6 +26,13 @@ CONF = config.CONF
class BaseAttachmentTest(manager.ScenarioTest):
@classmethod
def skip_checks(cls):
super(BaseAttachmentTest, cls).skip_checks()
if not CONF.service_available.cinder:
raise cls.skipException("Cinder is not available")
@classmethod
def setup_clients(cls):
super().setup_clients()

View File

@ -51,6 +51,8 @@ class TestStampPattern(manager.ScenarioTest):
@classmethod
def skip_checks(cls):
super(TestStampPattern, cls).skip_checks()
if not CONF.service_available.cinder:
raise cls.skipException("Cinder is not available")
if not CONF.volume_feature_enabled.snapshot:
raise cls.skipException("Cinder volume snapshots are disabled")

View File

@ -41,6 +41,8 @@ class TestVolumeBackupRestore(manager.ScenarioTest):
@classmethod
def skip_checks(cls):
super(TestVolumeBackupRestore, cls).skip_checks()
if not CONF.service_available.cinder:
raise cls.skipException("Cinder is not available")
if not CONF.volume_feature_enabled.backup:
raise cls.skipException('Backup is not enable.')

View File

@ -31,6 +31,12 @@ class TestVolumeBootPattern(manager.EncryptionScenarioTest):
# breathing room to get through deletes in the time allotted.
TIMEOUT_SCALING_FACTOR = 2
@classmethod
def skip_checks(cls):
super(TestVolumeBootPattern, cls).skip_checks()
if not CONF.service_available.cinder:
raise cls.skipException("Cinder is not available")
def _delete_server(self, server):
self.servers_client.delete_server(server['id'])
waiters.wait_for_server_termination(self.servers_client, server['id'])

View File

@ -48,6 +48,8 @@ class TestVolumeMigrateRetypeAttached(manager.ScenarioTest):
@classmethod
def skip_checks(cls):
super(TestVolumeMigrateRetypeAttached, cls).skip_checks()
if not CONF.service_available.cinder:
raise cls.skipException("Cinder is not available")
if not CONF.volume_feature_enabled.multi_backend:
raise cls.skipException("Cinder multi-backend feature disabled")