Cleanup resources with tempest more reliably
In case method setUpClass fails, method tearDownClass won't run and won't clear resources, it is fixed by adding decorator to setUpClass with forced run of tearDownClass. Also moved per-test cleanup from tearDown to setUp method using addCleanup from testtools module. Change-Id: Id0e2f42dc1bbf050f534c9439bd7e0b65e966d49
This commit is contained in:
parent
ff7757cf26
commit
d1a2334089
|
@ -20,6 +20,7 @@ from tempest import test
|
|||
class AdminActionsTest(base.BaseSharesAdminTest):
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
super(AdminActionsTest, cls).setUpClass()
|
||||
cls.states = ["error", "available"]
|
||||
|
|
|
@ -25,6 +25,7 @@ CONF = config.CONF
|
|||
class AdminActionsNegativeTest(base.BaseSharesAdminTest):
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
super(AdminActionsNegativeTest, cls).setUpClass()
|
||||
__, cls.sh = cls.create_share()
|
||||
|
|
|
@ -24,6 +24,7 @@ CONF = config.CONF
|
|||
class ShareMultiBackendTest(base.BaseSharesAdminTest):
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
super(ShareMultiBackendTest, cls).setUpClass()
|
||||
if not CONF.share.multi_backend:
|
||||
|
|
|
@ -24,6 +24,7 @@ CONF = config.CONF
|
|||
class SharesAdminQuotasTest(base.BaseSharesAdminTest):
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
cls.os = clients.AdminManager(interface=cls._interface)
|
||||
super(SharesAdminQuotasTest, cls).setUpClass()
|
||||
|
|
|
@ -29,6 +29,7 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
|
|||
force_tenant_isolation = True
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
cls.os = clients.AdminManager(interface=cls._interface)
|
||||
super(SharesAdminQuotasNegativeTest, cls).setUpClass()
|
||||
|
|
|
@ -22,6 +22,7 @@ from tempest import test
|
|||
class ServicesAdminNegativeTest(base.BaseSharesAdminTest):
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
super(ServicesAdminNegativeTest, cls).setUpClass()
|
||||
user_clients = clients.Manager(interface=cls._interface)
|
||||
|
|
|
@ -26,6 +26,7 @@ CONF = config.CONF
|
|||
class ShareServersAdminTest(base.BaseSharesAdminTest):
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
super(ShareServersAdminTest, cls).setUpClass()
|
||||
if not CONF.share.multitenancy_enabled:
|
||||
|
|
|
@ -23,6 +23,7 @@ from tempest import test
|
|||
class ShareServersNegativeAdminTest(base.BaseSharesAdminTest):
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
super(ShareServersNegativeAdminTest, cls).setUpClass()
|
||||
cls.member_shares_client = clients.Manager().shares_client
|
||||
|
|
|
@ -21,6 +21,7 @@ from tempest import test
|
|||
class ExtraSpecsAdminTest(base.BaseSharesAdminTest):
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
super(ExtraSpecsAdminTest, cls).setUpClass()
|
||||
vol_type_name = data_utils.rand_name("volume-type")
|
||||
|
|
|
@ -29,6 +29,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesAdminTest):
|
|||
return vt
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
super(ExtraSpecsAdminNegativeTest, cls).setUpClass()
|
||||
cls.member_shares_client = clients.Manager().shares_client
|
||||
|
|
|
@ -29,6 +29,7 @@ class VolumeTypesAdminNegativeTest(base.BaseSharesAdminTest):
|
|||
return vt
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
super(VolumeTypesAdminNegativeTest, cls).setUpClass()
|
||||
cls.member_shares_client = clients.Manager().shares_client
|
||||
|
|
|
@ -144,10 +144,10 @@ class BaseSharesTest(test.BaseTestCase):
|
|||
cls.os.shares_client.share_network_id = share_network_id
|
||||
cls.shares_client = cls.os.shares_client
|
||||
|
||||
def tearDown(self):
|
||||
super(BaseSharesTest, self).tearDown()
|
||||
self.clear_resources()
|
||||
self.clear_isolated_creds()
|
||||
def setUp(self):
|
||||
super(BaseSharesTest, self).setUp()
|
||||
self.addCleanup(self.clear_resources)
|
||||
self.addCleanup(self.clear_isolated_creds)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
|
|
@ -20,6 +20,7 @@ from tempest import test
|
|||
class SharesMetadataTest(base.BaseSharesTest):
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
super(SharesMetadataTest, cls).setUpClass()
|
||||
__, cls.share = cls.create_share()
|
||||
|
|
|
@ -21,6 +21,7 @@ from tempest import test
|
|||
class SharesMetadataNegativeTest(base.BaseSharesTest):
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
super(SharesMetadataNegativeTest, cls).setUpClass()
|
||||
__, cls.share = cls.create_share()
|
||||
|
|
|
@ -20,6 +20,7 @@ from tempest import test
|
|||
class SharesQuotasTest(base.BaseSharesTest):
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
super(SharesQuotasTest, cls).setUpClass()
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ class SharesQuotasNegativeTest(base.BaseSharesTest):
|
|||
force_tenant_isolation = True
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
super(SharesQuotasNegativeTest, cls).setUpClass()
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ class ShareIpRulesForNFSTest(base.BaseSharesTest):
|
|||
protocol = "nfs"
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
super(ShareIpRulesForNFSTest, cls).setUpClass()
|
||||
if (cls.protocol not in CONF.share.enable_protocols or
|
||||
|
@ -82,6 +83,7 @@ class ShareSidRulesForNFSTest(base.BaseSharesTest):
|
|||
protocol = "nfs"
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
super(ShareSidRulesForNFSTest, cls).setUpClass()
|
||||
if (cls.protocol not in CONF.share.enable_protocols or
|
||||
|
@ -118,6 +120,7 @@ class ShareSidRulesForCIFSTest(ShareSidRulesForNFSTest):
|
|||
class ShareRulesTest(base.BaseSharesTest):
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
super(ShareRulesTest, cls).setUpClass()
|
||||
if not (any(p in CONF.share.enable_ip_rules_for_protocols
|
||||
|
|
|
@ -25,6 +25,7 @@ class ShareIpRulesForNFSNegativeTest(base.BaseSharesTest):
|
|||
protocol = "nfs"
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
super(ShareIpRulesForNFSNegativeTest, cls).setUpClass()
|
||||
if not (cls.protocol in CONF.share.enable_protocols and
|
||||
|
@ -113,6 +114,7 @@ class ShareSidRulesForNFSNegativeTest(base.BaseSharesTest):
|
|||
protocol = "nfs"
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
super(ShareSidRulesForNFSNegativeTest, cls).setUpClass()
|
||||
if not (cls.protocol in CONF.share.enable_protocols and
|
||||
|
@ -181,6 +183,7 @@ class ShareRulesNegativeTest(base.BaseSharesTest):
|
|||
# Tests independent from rule type and share protocol
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
super(ShareRulesNegativeTest, cls).setUpClass()
|
||||
if not (any(p in CONF.share.enable_ip_rules_for_protocols
|
||||
|
|
|
@ -21,6 +21,7 @@ from tempest import test
|
|||
class SecServicesMappingNegativeTest(base.BaseSharesTest):
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
super(SecServicesMappingNegativeTest, cls).setUpClass()
|
||||
__, cls.sn = cls.create_share_network(cleanup_in_class=True)
|
||||
|
|
|
@ -20,6 +20,7 @@ from tempest import test
|
|||
class ShareNetworksTest(base.BaseSharesTest):
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
super(ShareNetworksTest, cls).setUpClass()
|
||||
cls.data = cls.generate_share_network_data()
|
||||
|
|
|
@ -26,6 +26,7 @@ class SharesNFSTest(base.BaseSharesTest):
|
|||
protocol = "nfs"
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
super(SharesNFSTest, cls).setUpClass()
|
||||
if cls.protocol not in CONF.share.enable_protocols:
|
||||
|
|
|
@ -25,6 +25,7 @@ class SharesTest(base.BaseSharesTest):
|
|||
"""Covers share functionality, that doesn't related to share type."""
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
super(SharesTest, cls).setUpClass()
|
||||
# create share
|
||||
|
@ -182,6 +183,7 @@ class SharesTest(base.BaseSharesTest):
|
|||
class SharesRenameTest(base.BaseSharesTest):
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
super(SharesRenameTest, cls).setUpClass()
|
||||
|
||||
|
|
Loading…
Reference in New Issue