From b1462e826aef2980ec12fef2fb89914c6a8606c5 Mon Sep 17 00:00:00 2001 From: Ashutosh K Date: Wed, 4 Dec 2013 18:41:10 +0530 Subject: [PATCH] CLOUDSTACK-5364: Resolving network cleanup issue in egress fw rules test cases --- .../integration/component/test_egress_fw_rules.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/test/integration/component/test_egress_fw_rules.py b/test/integration/component/test_egress_fw_rules.py index 6dcc2c4dd87..5f076ab4c5d 100644 --- a/test/integration/component/test_egress_fw_rules.py +++ b/test/integration/component/test_egress_fw_rules.py @@ -376,12 +376,21 @@ class TestEgressFWRules(cloudstackTestCase): self.debug("Cleaning up the resources") self.virtual_machine.delete(self.apiclient) wait_for_cleanup(self.apiclient, ["expunge.interval", "expunge.delay"]) - self.debug("Sleep for VM cleanup to complete.") - #time.sleep(self.services['sleep']) + + retriesCount = 5 + while True: + vms = list_virtual_machines(self.apiclient, id=self.virtual_machine.id) + if vms is None: + break + elif retriesCount == 0: + self.fail("Failed to delete/expunge VM") + + time.sleep(10) + retriesCount -= 1 + self.network.delete(self.apiclient) self.debug("Sleep for Network cleanup to complete.") wait_for_cleanup(self.apiclient, ["network.gc.wait", "network.gc.interval"]) - #time.sleep(self.services['sleep']) cleanup_resources(self.apiclient, reversed(self.cleanup)) self.debug("Cleanup complete!") except Exception as e: