Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 594E910BB4 for ; Tue, 14 Jan 2014 06:32:44 +0000 (UTC) Received: (qmail 60334 invoked by uid 500); 14 Jan 2014 05:50:45 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 60314 invoked by uid 500); 14 Jan 2014 05:50:39 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 60197 invoked by uid 99); 14 Jan 2014 05:50:02 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Jan 2014 05:50:02 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id BAFD38BC07E; Tue, 14 Jan 2014 05:50:01 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: girish@apache.org To: commits@cloudstack.apache.org Message-Id: <192b03c9afd545cca020c25377bfa5aa@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: updated refs/heads/master to 842b58d Date: Tue, 14 Jan 2014 05:50:01 +0000 (UTC) Updated Branches: refs/heads/master a957d52a3 -> 842b58d6e CLOUDTACK-5626: Made few changes to test_vpc_vm_life_cycle.py Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/842b58d6 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/842b58d6 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/842b58d6 Branch: refs/heads/master Commit: 842b58d6ee6038a43f11caf3929fe4e7504409d4 Parents: a957d52 Author: Girish Shilamkar Authored: Tue Jan 14 11:13:48 2014 +0530 Committer: Girish Shilamkar Committed: Tue Jan 14 11:19:22 2014 +0530 ---------------------------------------------------------------------- .../component/test_vpc_vm_life_cycle.py | 104 ++++++++++++------- 1 file changed, 67 insertions(+), 37 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/842b58d6/test/integration/component/test_vpc_vm_life_cycle.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_vpc_vm_life_cycle.py b/test/integration/component/test_vpc_vm_life_cycle.py index 5ce94f2..01373ac 100644 --- a/test/integration/component/test_vpc_vm_life_cycle.py +++ b/test/integration/component/test_vpc_vm_life_cycle.py @@ -18,13 +18,31 @@ """ Component tests VM life cycle in VPC network functionality """ #Import Local Modules -import marvin from nose.plugins.attrib import attr -from marvin.cloudstackTestCase import * -from marvin.cloudstackAPI import * -from marvin.integration.lib.utils import * -from marvin.integration.lib.base import * -from marvin.integration.lib.common import * +from marvin.cloudstackTestCase import cloudstackTestCase, unittest +from marvin.integration.lib.utils import cleanup_resources, validateList +from marvin.integration.lib.base import (VirtualMachine, + NATRule, + LoadBalancerRule, + StaticNATRule, + PublicIPAddress, + VPC, + VpcOffering, + Network, + NetworkOffering, + NetworkACL, + Router, + Account, + ServiceOffering, + Host) +from marvin.integration.lib.common import (get_domain, + get_zone, + get_template, + get_free_vlan, + wait_for_cleanup, + list_virtual_machines, + list_hosts) + from marvin.codes import PASS import time @@ -644,6 +662,13 @@ class TestVMLifeCycleVPC(cloudstackTestCase): True, "List LB rules shall return a valid list" ) + + #Recover the instances so that they don't get expunged before runing next test case in the suite + try: + self.vm_1.recover(self.apiclient) + self.vm_2.recover(self.apiclient) + except Exception as e: + self.fail("Failed to recover the virtual instances, %s" % e) return @attr(tags=["advanced", "intervlan"]) @@ -690,6 +715,11 @@ class TestVMLifeCycleVPC(cloudstackTestCase): # works as expected. # 3. Make sure that we are able to access google.com from this user Vm + vm_list = VirtualMachine.list(self.apiclient, id=self.vm_1.id) + self.assertEqual(validateList(vm_list)[0], PASS, "vm list validation failed, vm list is %s" % vm_list) + + vm_hostid = vm_list[0].hostid + self.debug("Checking if the host is available for migration?") hosts = Host.list( self.apiclient, @@ -707,7 +737,7 @@ class TestVMLifeCycleVPC(cloudstackTestCase): "No host available for migration. Test requires atleast 2 hosts") # Remove the host of current VM from the hosts list - hosts[:] = [host for host in hosts if host.id != self.vm_1.hostid] + hosts[:] = [host for host in hosts if host.id != vm_hostid] host = hosts[0] @@ -847,17 +877,17 @@ class TestVMLifeCycleVPC(cloudstackTestCase): # Check if the network rules still exists after Vm stop self.debug("Checking if NAT rules existed") with self.assertRaises(Exception): - nat_rules = NATRule.list( - self.apiclient, - id=self.nat_rule.id, - listall=True - ) + NATRule.list( + self.apiclient, + id=self.nat_rule.id, + listall=True + ) - lb_rules = LoadBalancerRule.list( - self.apiclient, - id=self.lb_rule.id, - listall=True - ) + LoadBalancerRule.list( + self.apiclient, + id=self.lb_rule.id, + listall=True + ) return class TestVMLifeCycleSharedNwVPC(cloudstackTestCase): @@ -1651,17 +1681,17 @@ class TestVMLifeCycleSharedNwVPC(cloudstackTestCase): # Check if the network rules still exists after Vm expunged self.debug("Checking if NAT rules existed ") with self.assertRaises(Exception): - nat_rules = NATRule.list( - self.apiclient, - id=self.nat_rule.id, - listall=True - ) + NATRule.list( + self.apiclient, + id=self.nat_rule.id, + listall=True + ) - lb_rules = LoadBalancerRule.list( - self.apiclient, - id=self.lb_rule.id, - listall=True - ) + LoadBalancerRule.list( + self.apiclient, + id=self.lb_rule.id, + listall=True + ) return class TestVMLifeCycleBothIsolated(cloudstackTestCase): @@ -2687,17 +2717,17 @@ class TestVMLifeCycleStoppedVPCVR(cloudstackTestCase): # Check if the network rules still exists after Vm expunged self.debug("Checking if NAT rules existed ") with self.assertRaises(Exception): - nat_rules = NATRule.list( - self.apiclient, - id=self.nat_rule.id, - listall=True - ) + NATRule.list( + self.apiclient, + id=self.nat_rule.id, + listall=True + ) - lb_rules = LoadBalancerRule.list( - self.apiclient, - id=self.lb_rule.id, - listall=True - ) + LoadBalancerRule.list( + self.apiclient, + id=self.lb_rule.id, + listall=True + ) return class TestVMLifeCycleDiffHosts(cloudstackTestCase):