From a92abaa91611d7152ee58247df257fd5ec147cf2 Mon Sep 17 00:00:00 2001 From: Prasanna Santhanam Date: Tue, 14 May 2013 11:42:34 +0530 Subject: [PATCH] multiple fixes to regression tests in test/component - invalid variable references - syntax/indentation errors - self/cls reference errors - some logic fixes in redundant router suite Signed-off-by: Prasanna Santhanam --- test/integration/component/test_eip_elb.py | 4 ++-- .../component/test_redundant_router.py | 18 +++++++-------- .../component/test_security_groups.py | 4 ++-- test/integration/component/test_vpc.py | 3 +-- .../component/test_vpc_vms_deployment.py | 4 ++-- test/integration/component/test_vpn_users.py | 22 +++++++++---------- 6 files changed, 27 insertions(+), 28 deletions(-) diff --git a/test/integration/component/test_eip_elb.py b/test/integration/component/test_eip_elb.py index b01371b7643..14af4a3463f 100644 --- a/test/integration/component/test_eip_elb.py +++ b/test/integration/component/test_eip_elb.py @@ -150,7 +150,7 @@ class TestEIP(cloudstackTestCase): else: raise Exception( "No Source NAT IP found for guest network: %s" % - guest_network.id) + cls.guest_network.id) cls._cleanup = [ cls.account, cls.service_offering, @@ -759,7 +759,7 @@ class TestEIP(cloudstackTestCase): with self.assertRaises(Exception): cmd = disassociateIpAddress.disassociateIpAddressCmd() cmd.id = static_nat.id - apiclient.disassociateIpAddress(cmd) + self.api_client.disassociateIpAddress(cmd) self.debug("Disassociate system IP failed") return diff --git a/test/integration/component/test_redundant_router.py b/test/integration/component/test_redundant_router.py index aaac13df781..8885241ef7b 100644 --- a/test/integration/component/test_redundant_router.py +++ b/test/integration/component/test_redundant_router.py @@ -878,7 +878,7 @@ class TestRVRInternals(cloudstackTestCase): ) else: result = get_process_status( - host.ipaddress, + master_host.ipaddress, self.services['host']["publicport"], self.services['host']["username"], self.services['host']["password"], @@ -914,7 +914,7 @@ class TestRVRInternals(cloudstackTestCase): ) else: result = get_process_status( - host.ipaddress, + backup_host.ipaddress, self.services['host']["publicport"], self.services['host']["username"], self.services['host']["password"], @@ -1107,7 +1107,7 @@ class TestRedundancy(cloudstackTestCase): self.debug("Stopping the MASTER router") try: - cmd = stopRouter.stopRouter(cmd) + cmd = stopRouter.stopRouterCmd() cmd.id = master_router.id self.apiclient.stopRouter(cmd) except Exception as e: @@ -1234,7 +1234,7 @@ class TestRedundancy(cloudstackTestCase): self.debug("Stopping the BACKUP router") try: - cmd = stopRouter.stopRouter(cmd) + cmd = stopRouter.stopRouterCmd() cmd.id = backup_router.id self.apiclient.stopRouter(cmd) except Exception as e: @@ -1355,7 +1355,7 @@ class TestRedundancy(cloudstackTestCase): self.debug("Rebooting the master router") try: - cmd = rebootRouter.rebootRouter(cmd) + cmd = rebootRouter.rebootRouterCmd() cmd.id = master_router.id self.apiclient.rebootRouter(cmd) except Exception as e: @@ -1449,7 +1449,7 @@ class TestRedundancy(cloudstackTestCase): self.debug("Rebooting the backuo router") try: - cmd = rebootRouter.rebootRouter(cmd) + cmd = rebootRouter.rebootRouterCmd() cmd.id = backup_router.id self.apiclient.rebootRouter(cmd) except Exception as e: @@ -1543,7 +1543,7 @@ class TestRedundancy(cloudstackTestCase): self.debug("Stopping the backup router") try: - cmd = stopRouter.stopRouter(cmd) + cmd = stopRouter.stopRouterCmd() cmd.id = backup_router.id self.apiclient.stopRouter(cmd) except Exception as e: @@ -1574,9 +1574,9 @@ class TestRedundancy(cloudstackTestCase): accountid=self.account.name, domainid=self.account.account.domainid, serviceofferingid=self.service_offering.id, - networkids=[str(network.id)] + networkids=[str(self.network.id)] ) - self.debug("Deployed VM in network: %s" % network.id) + self.debug("Deployed VM in network: %s" % self.network.id) vms = VirtualMachine.list( self.apiclient, diff --git a/test/integration/component/test_security_groups.py b/test/integration/component/test_security_groups.py index 54b5c67fa4d..2ed27fe0c5d 100644 --- a/test/integration/component/test_security_groups.py +++ b/test/integration/component/test_security_groups.py @@ -988,7 +988,7 @@ class TestDeleteSecurityGroup(cloudstackTestCase): # Get Zone, Domain and templates self.domain = get_domain(self.apiclient, self.services) self.zone = get_zone(self.apiclient, self.services) - self.services['mode'] = cls.zone.networktype + self.services['mode'] = self.zone.networktype template = get_template( self.apiclient, @@ -1234,7 +1234,7 @@ class TestIngressRule(cloudstackTestCase): # Get Zone, Domain and templates self.domain = get_domain(self.apiclient, self.services) self.zone = get_zone(self.apiclient, self.services) - self.services['mode'] = cls.zone.networktype + self.services['mode'] = self.zone.networktype template = get_template( self.apiclient, diff --git a/test/integration/component/test_vpc.py b/test/integration/component/test_vpc.py index 1156b5b6c3e..83b913a8738 100644 --- a/test/integration/component/test_vpc.py +++ b/test/integration/component/test_vpc.py @@ -2567,8 +2567,7 @@ class TestVPCHostMaintenance(cloudstackTestCase): ) if hosts_states[0].resourcestate != 'Enabled': raise Exception( - "Failed to cancel maintenance mode on %s, e" % ( - host.name, e)) + "Failed to cancel maintenance mode on %s" % (host.name)) except Exception as e: raise Exception("Warning: Exception during cleanup : %s" % e) return diff --git a/test/integration/component/test_vpc_vms_deployment.py b/test/integration/component/test_vpc_vms_deployment.py index d29faa5c8a0..506ae348867 100644 --- a/test/integration/component/test_vpc_vms_deployment.py +++ b/test/integration/component/test_vpc_vms_deployment.py @@ -1900,7 +1900,7 @@ class TestVMDeployVPC(cloudstackTestCase): vpcid=vpc.id ) self.debug("Associated %s with network %s" % ( - public_ip.ipaddress.ipaddress, + public_ip_1.ipaddress.ipaddress, network_1.id )) @@ -2365,7 +2365,7 @@ class TestVMDeployVPC(cloudstackTestCase): self.debug("Verifying if we can ping to outside world from VM?") # Ping to outsite world - res = ssh_5.execute("ping -c 1 www.google.com") + res = ssh_4.execute("ping -c 1 www.google.com") # res = 64 bytes from maa03s17-in-f20.1e100.net (74.125.236.212): # icmp_req=1 ttl=57 time=25.9 ms # --- www.l.google.com ping statistics --- diff --git a/test/integration/component/test_vpn_users.py b/test/integration/component/test_vpn_users.py index 93186546d94..8f08fa09c38 100644 --- a/test/integration/component/test_vpn_users.py +++ b/test/integration/component/test_vpn_users.py @@ -91,28 +91,28 @@ class Services: class TestVPNUsers(cloudstackTestCase): - @classmethod def setUpClass(cls): cls.api_client = super(TestVPNUsers, - cls).getClsTestClient().getApiClient() + cls).getClsTestClient().getApiClient() cls.services = Services().services # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client, cls.services) cls.zone = get_zone(cls.api_client, cls.services) - cls.services["mode"] = cls.zone.networktype - cls.template = get_template( - cls.api_client, - cls.zone.id, - cls.services["ostype"] - ) + cls.services["mode"] = cls.zone.networktype + + cls.template = get_template( + cls.api_client, + cls.zone.id, + cls.services["ostype"] + ) cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.service_offering = ServiceOffering.create( - cls.api_client, - cls.services["service_offering"] - ) + cls.api_client, + cls.services["service_offering"] + ) cls._cleanup = [cls.service_offering, ] return