mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Automation: Fix enormous missing tearDown() for test cases
This result in countless test case failure because many test case units didn't clean up after it. The regression test result should be improved quite a bit after this change.
This commit is contained in:
parent
2cf8ecd3e2
commit
5b238fa4af
@ -103,9 +103,7 @@ class TestTemplate(cloudstackTestCase):
|
||||
|
||||
def tearDown(self):
|
||||
try:
|
||||
#Clean up, terminate the created templates
|
||||
cleanup_resources(self.apiclient, self.cleanup)
|
||||
|
||||
except Exception as e:
|
||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||
return
|
||||
@ -285,6 +283,13 @@ class TestNATRules(cloudstackTestCase):
|
||||
self.cleanup = []
|
||||
return
|
||||
|
||||
def tearDown(self):
|
||||
try:
|
||||
cleanup_resources(self.apiclient, self.cleanup)
|
||||
except Exception as e:
|
||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||
return
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
try:
|
||||
@ -293,10 +298,6 @@ class TestNATRules(cloudstackTestCase):
|
||||
except Exception as e:
|
||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||
|
||||
def tearDown(self):
|
||||
cleanup_resources(self.apiclient, self.cleanup)
|
||||
return
|
||||
|
||||
@attr(tags = ["advanced"])
|
||||
def test_01_firewall_rules_port_fw(self):
|
||||
""""Checking firewall rules deletion after static NAT disable"""
|
||||
@ -493,7 +494,6 @@ class TestRouters(cloudstackTestCase):
|
||||
|
||||
def tearDown(self):
|
||||
try:
|
||||
#Clean up, terminate the created instance, users etc
|
||||
cleanup_resources(self.apiclient, self.cleanup)
|
||||
except Exception as e:
|
||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||
@ -610,6 +610,13 @@ class TestRouterRestart(cloudstackTestCase):
|
||||
self.apiclient = self.testClient.getApiClient()
|
||||
return
|
||||
|
||||
def tearDown(self):
|
||||
try:
|
||||
cleanup_resources(self.apiclient, self.cleanup)
|
||||
except Exception as e:
|
||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||
return
|
||||
|
||||
@attr(tags = ["advanced", "basic", "sg", "advancedns", "eip"])
|
||||
def test_01_restart_network_cleanup(self):
|
||||
"""TS_BUG_008-Test restart network
|
||||
|
||||
@ -165,7 +165,6 @@ class TestCreateRvRNetworkOffering(cloudstackTestCase):
|
||||
|
||||
def tearDown(self):
|
||||
try:
|
||||
#Clean up, terminate the created network offerings
|
||||
cleanup_resources(self.apiclient, self.cleanup)
|
||||
except Exception as e:
|
||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||
@ -287,6 +286,13 @@ class TestCreateRvRNetwork(cloudstackTestCase):
|
||||
self._cleanup.insert(0, self.account)
|
||||
return
|
||||
|
||||
def tearDown(self):
|
||||
try:
|
||||
cleanup_resources(self.apiclient, self.cleanup)
|
||||
except Exception as e:
|
||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "advancedns", "ssh"])
|
||||
def test_createRvRNetwork(self):
|
||||
"""Test create network with redundant routers
|
||||
@ -478,6 +484,13 @@ class TestCreateRvRNetworkNonDefaultGuestCidr(cloudstackTestCase):
|
||||
self._cleanup.insert(0, self.account)
|
||||
return
|
||||
|
||||
def tearDown(self):
|
||||
try:
|
||||
cleanup_resources(self.apiclient, self.cleanup)
|
||||
except Exception as e:
|
||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "advancedns"])
|
||||
def test_createRvRNetwork(self):
|
||||
"""Test create network with non-default guest cidr with redundant routers
|
||||
@ -678,6 +691,13 @@ class TestRVRInternals(cloudstackTestCase):
|
||||
self._cleanup.insert(0, self.account)
|
||||
return
|
||||
|
||||
def tearDown(self):
|
||||
try:
|
||||
cleanup_resources(self.apiclient, self.cleanup)
|
||||
except Exception as e:
|
||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "advancedns", "ssh"])
|
||||
def test_redundantVR_internals(self):
|
||||
"""Test redundant router internals
|
||||
@ -991,6 +1011,13 @@ class TestRvRRedundancy(cloudstackTestCase):
|
||||
self._cleanup.insert(0, self.account)
|
||||
return
|
||||
|
||||
def tearDown(self):
|
||||
try:
|
||||
cleanup_resources(self.apiclient, self.cleanup)
|
||||
except Exception as e:
|
||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "advancedns", "ssh"])
|
||||
def test_stopMasterRvR(self):
|
||||
"""Test stop master RVR
|
||||
|
||||
@ -192,6 +192,14 @@ class TestRedundantRouterNetworkCleanups(cloudstackTestCase):
|
||||
self._cleanup.insert(0, self.account)
|
||||
return
|
||||
|
||||
def tearDown(self):
|
||||
try:
|
||||
cleanup_resources(self.apiclient, self._cleanup)
|
||||
except Exception as e:
|
||||
self.debug("Warning: Exception during cleanup : %s" % e)
|
||||
#raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "advancedns", "ssh"])
|
||||
def test_restart_ntwk_no_cleanup(self):
|
||||
"""Test restarting RvR network without cleanup
|
||||
@ -672,4 +680,4 @@ class TestRedundantRouterNetworkCleanups(cloudstackTestCase):
|
||||
"Stopped",
|
||||
"Router should be in stopped state"
|
||||
)
|
||||
return
|
||||
return
|
||||
|
||||
@ -191,6 +191,14 @@ class TestRvRDeploymentPlanning(cloudstackTestCase):
|
||||
self._cleanup.insert(0, self.account)
|
||||
return
|
||||
|
||||
def tearDown(self):
|
||||
try:
|
||||
cleanup_resources(self.apiclient, self._cleanup)
|
||||
except Exception as e:
|
||||
self.debug("Warning: Exception during cleanup : %s" % e)
|
||||
#raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "advancedns"])
|
||||
def test_RvR_multipods(self):
|
||||
"""Test RvR with multi pods
|
||||
@ -1003,4 +1011,4 @@ class TestRvRDeploymentPlanning(cloudstackTestCase):
|
||||
cmd.id = cluster.id
|
||||
cmd.allocationstate = 'Enabled'
|
||||
self.apiclient.updateCluster(cmd)
|
||||
return
|
||||
return
|
||||
|
||||
@ -191,6 +191,14 @@ class TestRedundantRouterRulesLifeCycle(cloudstackTestCase):
|
||||
self._clean.insert(0, self.account)
|
||||
return
|
||||
|
||||
def tearDown(self):
|
||||
try:
|
||||
cleanup_resources(self.apiclient, self._cleanup)
|
||||
except Exception as e:
|
||||
self.debug("Warning: Exception during cleanup : %s" % e)
|
||||
#raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "advancedns", "ssh"])
|
||||
def test_applyNetworkRules_MasterDown_deleteNetworkRules(self):
|
||||
"""Test apply network rules when master & backup routers rebooted
|
||||
@ -1413,4 +1421,4 @@ class TestRedundantRouterRulesLifeCycle(cloudstackTestCase):
|
||||
"Running",
|
||||
"Router state should be running"
|
||||
)
|
||||
return
|
||||
return
|
||||
|
||||
@ -193,6 +193,13 @@ class TestEnableVPNOverRvR(cloudstackTestCase):
|
||||
self._cleanup.insert(0, self.account)
|
||||
return
|
||||
|
||||
def tearDown(self):
|
||||
try:
|
||||
cleanup_resources(self.apiclient, self.cleanup)
|
||||
except Exception as e:
|
||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "advancedns", "ssh"])
|
||||
def test_enableVPNOverRvR(self):
|
||||
"""Test redundant router internals
|
||||
|
||||
@ -192,6 +192,13 @@ class TestRvRUpgradeDowngrade(cloudstackTestCase):
|
||||
self._cleanup.insert(0, self.account)
|
||||
return
|
||||
|
||||
def tearDown(self):
|
||||
try:
|
||||
cleanup_resources(self.apiclient, self.cleanup)
|
||||
except Exception as e:
|
||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "advancedns", "ssh"])
|
||||
def test_upgradeVR_to_redundantVR(self):
|
||||
"""Test upgrade virtual router to redundant virtual router
|
||||
|
||||
@ -160,6 +160,14 @@ class TestAttachVolume(cloudstackTestCase):
|
||||
self.dbclient = self.testClient.getDbConnection()
|
||||
self.cleanup = []
|
||||
|
||||
def tearDown(self):
|
||||
try:
|
||||
cleanup_resources(self.apiclient, self._cleanup)
|
||||
except Exception as e:
|
||||
self.debug("Warning: Exception during cleanup : %s" % e)
|
||||
#raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||
return
|
||||
|
||||
@attr(tags = ["advanced", "advancedns"])
|
||||
def test_01_volume_attach(self):
|
||||
"""Test Attach volumes (max capacity)
|
||||
|
||||
@ -226,6 +226,14 @@ class TestVPC(cloudstackTestCase):
|
||||
self._cleanup.insert(0, self.account)
|
||||
return
|
||||
|
||||
def tearDown(self):
|
||||
try:
|
||||
cleanup_resources(self.apiclient, self._cleanup)
|
||||
except Exception as e:
|
||||
self.debug("Warning: Exception during cleanup : %s" % e)
|
||||
#raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||
return
|
||||
|
||||
def validate_vpc_offering(self, vpc_offering):
|
||||
"""Validates the VPC offering"""
|
||||
|
||||
|
||||
@ -230,6 +230,14 @@ class TestVPCNetwork(cloudstackTestCase):
|
||||
self._cleanup.insert(0, self.account)
|
||||
return
|
||||
|
||||
def tearDown(self):
|
||||
try:
|
||||
cleanup_resources(self.apiclient, self._cleanup)
|
||||
except Exception as e:
|
||||
self.debug("Warning: Exception during cleanup : %s" % e)
|
||||
#raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||
return
|
||||
|
||||
def validate_vpc_offering(self, vpc_offering):
|
||||
"""Validates the VPC offering"""
|
||||
|
||||
@ -1078,6 +1086,14 @@ class TestVPCNetworkRanges(cloudstackTestCase):
|
||||
self._cleanup.insert(0, self.account)
|
||||
return
|
||||
|
||||
def tearDown(self):
|
||||
try:
|
||||
cleanup_resources(self.apiclient, self._cleanup)
|
||||
except Exception as e:
|
||||
self.debug("Warning: Exception during cleanup : %s" % e)
|
||||
#raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||
return
|
||||
|
||||
def validate_vpc_offering(self, vpc_offering):
|
||||
"""Validates the VPC offering"""
|
||||
|
||||
@ -1573,6 +1589,14 @@ class TestVPCNetworkUpgrade(cloudstackTestCase):
|
||||
self._cleanup.insert(0, self.account)
|
||||
return
|
||||
|
||||
def tearDown(self):
|
||||
try:
|
||||
cleanup_resources(self.apiclient, self._cleanup)
|
||||
except Exception as e:
|
||||
self.debug("Warning: Exception during cleanup : %s" % e)
|
||||
#raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||
return
|
||||
|
||||
def validate_vpc_offering(self, vpc_offering):
|
||||
"""Validates the VPC offering"""
|
||||
|
||||
|
||||
@ -183,6 +183,13 @@ class TestVPCOffering(cloudstackTestCase):
|
||||
self._cleanup.insert(0, self.account)
|
||||
return
|
||||
|
||||
def tearDown(self):
|
||||
try:
|
||||
cleanup_resources(self.apiclient, self.cleanup)
|
||||
except Exception as e:
|
||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||
return
|
||||
|
||||
def validate_vpc_offering(self, vpc_offering):
|
||||
"""Validates the VPC offering"""
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user