Moving skip conditions under skip_check classmethod

Skipping conditions shouldn't be under resource_setup
classmethod. This method is used to create resources
for test methods.

Change-Id: I477d64cbda446c53f749d9f36acfbd2d198a5272
This commit is contained in:
lkuchlan 2021-01-19 10:32:17 +02:00
parent b3a3c420c7
commit 7f8e0ac2a1
6 changed files with 23 additions and 16 deletions

View File

@ -40,17 +40,14 @@ class ManageNFSShareTest(base.BaseSharesAdminTest):
super(ManageNFSShareTest, cls).skip_checks()
if not CONF.share.run_manage_unmanage_tests:
raise cls.skipException('Manage/unmanage tests are disabled.')
@classmethod
def resource_setup(cls):
if cls.protocol not in CONF.share.enable_protocols:
message = "%s tests are disabled" % cls.protocol
raise cls.skipException(message)
utils.skip_if_manage_not_supported_for_version()
@classmethod
def resource_setup(cls):
super(ManageNFSShareTest, cls).resource_setup()
# Create share type
cls.st_name = data_utils.rand_name("manage-st-name")
cls.extra_specs = {

View File

@ -39,17 +39,15 @@ class ManageNFSShareNegativeTest(base.BaseSharesAdminTest):
super(ManageNFSShareNegativeTest, cls).skip_checks()
if not CONF.share.run_manage_unmanage_tests:
raise cls.skipException('Manage/unmanage tests are disabled.')
@classmethod
def resource_setup(cls):
if cls.protocol not in CONF.share.enable_protocols:
message = "%s tests are disabled" % cls.protocol
raise cls.skipException(message)
utils.skip_if_manage_not_supported_for_version()
@classmethod
def resource_setup(cls):
super(ManageNFSShareNegativeTest, cls).resource_setup()
# Create share type
cls.st_name = data_utils.rand_name("manage-st-name")
cls.extra_specs = {

View File

@ -33,10 +33,14 @@ SHARE_REPLICAS_MICROVERSION = "2.53"
class SharesQuotasTest(base.BaseSharesTest):
@classmethod
def resource_setup(cls):
def skip_checks(cls):
super(SharesQuotasTest, cls).skip_checks()
if not CONF.share.run_quota_tests:
msg = "Quota tests are disabled."
raise cls.skipException(msg)
@classmethod
def resource_setup(cls):
super(SharesQuotasTest, cls).resource_setup()
cls.user_id = cls.shares_v2_client.user_id
cls.tenant_id = cls.shares_v2_client.tenant_id

View File

@ -28,11 +28,11 @@ CONF = config.CONF
class SharesQuotasNegativeTest(base.BaseSharesTest):
@classmethod
def resource_setup(cls):
def skip_checks(cls):
super(SharesQuotasNegativeTest, cls).skip_checks()
if not CONF.share.run_quota_tests:
msg = "Quota tests are disabled."
raise cls.skipException(msg)
super(SharesQuotasNegativeTest, cls).resource_setup()
@decorators.idempotent_id('d0dfe81d-8e8c-4847-a55f-95ba8a3d922c')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)

View File

@ -467,8 +467,8 @@ class ShareRulesNegativeTest(base.BaseSharesMixedTest):
# Tests independent from rule type and share protocol
@classmethod
def resource_setup(cls):
super(ShareRulesNegativeTest, cls).resource_setup()
def skip_checks(cls):
super(ShareRulesNegativeTest, cls).skip_checks()
if not (any(p in CONF.share.enable_ip_rules_for_protocols
for p in cls.protocols) or
any(p in CONF.share.enable_user_rules_for_protocols
@ -479,6 +479,10 @@ class ShareRulesNegativeTest(base.BaseSharesMixedTest):
for p in cls.protocols)):
cls.message = "Rule tests are disabled"
raise cls.skipException(cls.message)
@classmethod
def resource_setup(cls):
super(ShareRulesNegativeTest, cls).resource_setup()
# create share type
cls.share_type = cls._create_share_type()
cls.share_type_id = cls.share_type['id']

View File

@ -30,11 +30,15 @@ class SharesNFSTest(base.BaseSharesMixedTest):
protocol = "nfs"
@classmethod
def resource_setup(cls):
super(SharesNFSTest, cls).resource_setup()
def skip_checks(cls):
super(SharesNFSTest, cls).skip_checks()
if cls.protocol not in CONF.share.enable_protocols:
message = "%s tests are disabled" % cls.protocol
raise cls.skipException(message)
@classmethod
def resource_setup(cls):
super(SharesNFSTest, cls).resource_setup()
# create share_type
cls.share_type = cls._create_share_type()
cls.share_type_id = cls.share_type['id']