CLOUDSTACK-9531: Try template teardown without failure As per previous discussions and ticket, a template deletion may result in failure (exception thrown) for templates that are not properly downloaded. The tearDown method, a template may be tried for deletion but on failure we may ignore it as account deletion/tearDown would retry to cleanup resource owned by the account.
Signed-off-by: Rohit Yadav <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5545bcaa Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5545bcaa Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5545bcaa Branch: refs/heads/4.8 Commit: 5545bcaa9de9ddcc2e4842dc5d2bb073897ebef2 Parents: 394f2e3 Author: Rohit Yadav <[email protected]> Authored: Tue Oct 4 17:42:53 2016 +0530 Committer: Rohit Yadav <[email protected]> Committed: Thu Oct 6 15:38:01 2016 +0530 ---------------------------------------------------------------------- test/integration/smoke/test_internal_lb.py | 5 ++++- test/integration/smoke/test_vpc_vpn.py | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5545bcaa/test/integration/smoke/test_internal_lb.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_internal_lb.py b/test/integration/smoke/test_internal_lb.py index b378db9..d8a45c0 100644 --- a/test/integration/smoke/test_internal_lb.py +++ b/test/integration/smoke/test_internal_lb.py @@ -302,7 +302,7 @@ class TestInternalLb(cloudstackTestCase): %s" % (cls.account.name, cls.account.id)) - cls._cleanup = [cls.template, cls.account, cls.compute_offering] + cls._cleanup = [cls.account, cls.compute_offering] return def setUp(self): @@ -842,6 +842,9 @@ class TestInternalLb(cloudstackTestCase): def tearDownClass(cls): try: cls.logger.debug("Cleaning up class resources") + try: + cls.template.delete(cls.apiclient) + except Exception: pass cleanup_resources(cls.apiclient, cls._cleanup) except Exception as e: raise Exception("Cleanup failed with %s" % e) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5545bcaa/test/integration/smoke/test_vpc_vpn.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_vpc_vpn.py b/test/integration/smoke/test_vpc_vpn.py index 698cda7..a0639d5 100644 --- a/test/integration/smoke/test_vpc_vpn.py +++ b/test/integration/smoke/test_vpc_vpn.py @@ -299,7 +299,7 @@ class TestVpcRemoteAccessVpn(cloudstackTestCase): %s" % (cls.account.name, cls.account.id)) - cls.cleanup = [cls.template, cls.account, cls.compute_offering] + cls.cleanup = [cls.account, cls.compute_offering] return @attr(tags=["advanced"], required_hardware="true") @@ -435,6 +435,9 @@ class TestVpcRemoteAccessVpn(cloudstackTestCase): try: cls.logger.debug("Cleaning up resources") + try: + cls.template.delete(cls.apiclient) + except Exception: pass cleanup_resources(cls.apiclient, cls.cleanup) except Exception, e: raise Exception("Cleanup failed with %s" % e) @@ -479,7 +482,7 @@ class TestVpcSite2SiteVpn(cloudstackTestCase): %s" % (cls.account.name, cls.account.id)) - cls.cleanup = [cls.template, cls.account, cls.compute_offering] + cls.cleanup = [cls.account, cls.compute_offering] return def _get_ssh_client(self, virtual_machine, services, retries): @@ -798,6 +801,9 @@ class TestVpcSite2SiteVpn(cloudstackTestCase): @classmethod def tearDownClass(cls): try: + try: + cls.template.delete(cls.apiclient) + except Exception: pass cleanup_resources(cls.apiclient, cls.cleanup) except Exception, e: raise Exception("Cleanup failed with %s" % e) @@ -842,7 +848,7 @@ class TestRVPCSite2SiteVpn(cloudstackTestCase): %s" % (cls.account.name, cls.account.id)) - cls.cleanup = [cls.template, cls.account, cls.compute_offering] + cls.cleanup = [cls.account, cls.compute_offering] return def _validate_vpc_offering(self, vpc_offering): @@ -1165,6 +1171,9 @@ class TestRVPCSite2SiteVpn(cloudstackTestCase): @classmethod def tearDownClass(cls): try: + try: + cls.template.delete(cls.apiclient) + except Exception: pass cleanup_resources(cls.apiclient, cls.cleanup) except Exception, e: raise Exception("Cleanup failed with %s" % e)
