CLOUDSTACK-5364: Resolving network cleanup issue in egress fw rules test cases
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/542858a8 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/542858a8 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/542858a8 Branch: refs/heads/4.3 Commit: 542858a88f147c9f830a60b85649f48a99546f9b Parents: ab2e171 Author: Ashutosh K <[email protected]> Authored: Wed Dec 4 18:41:10 2013 +0530 Committer: Girish Shilamkar <[email protected]> Committed: Wed Dec 4 18:41:58 2013 +0530 ---------------------------------------------------------------------- test/integration/component/test_egress_fw_rules.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/542858a8/test/integration/component/test_egress_fw_rules.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_egress_fw_rules.py b/test/integration/component/test_egress_fw_rules.py index 6dcc2c4d..5f076ab 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:
