Fix tab/space issues

Several test failures occurred due to tab issues

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
This commit is contained in:
Prasanna Santhanam 2013-06-30 13:20:27 +05:30
parent 2a51c3e2c9
commit c7315975d2
8 changed files with 409 additions and 482 deletions

View File

@ -304,15 +304,14 @@ class TestListAffinityGroups(cloudstackTestCase):
def tearDown(self):
try:
cls.api_client = super(TestListAffinityGroups, cls).getClsTestClient().getApiClient()
self.api_client = super(TestListAffinityGroups, self).getClsTestClient().getApiClient()
#Clean up, terminate the created templates
cleanup_resources(cls.api_client, cls.cleanup)
cleanup_resources(self.api_client, self.cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
@classmethod
def tearDownClass(cls):
try:
cls.api_client = super(TestListAffinityGroups, cls).getClsTestClient().getApiClient()
#Clean up, terminate the created templates
@ -327,10 +326,6 @@ class TestListAffinityGroups(cloudstackTestCase):
api_client = self.api_client
if aff_grp == None:
self.services["host_anti_affinity_0"]
#if acc == None:
# acc = self.account.name
#if domainid == None:
# domainid = self.domain.id
try:
self.aff_grp.append(AffinityGroup.create(api_client,
@ -339,34 +334,25 @@ class TestListAffinityGroups(cloudstackTestCase):
raise Exception("Error: Creation of Affinity Group failed : %s" %e)
def create_vm_in_aff_grps(self, ag_list):
#try:
self.debug('Creating VM in AffinityGroup=%s' % ag_list[0])
vm = VirtualMachine.create(
self.api_client,
self.services["virtual_machine"],
templateid=self.template.id,
#accountid=self.account.name,
#domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
affinitygroupnames=ag_list
)
self.debug('Created VM=%s in Affinity Group=%s' %
(vm.id, ag_list[0]))
#except Exception:
#self.debug('Unable to create VM in a Affinity Group=%s'
# % ag_list[0])
list_vm = list_virtual_machines(self.api_client, id=vm.id)
self.assertEqual(isinstance(list_vm, list), True,
"Check list response returns a valid list")
self.assertNotEqual(len(list_vm),0,
"Check VM available in List Virtual Machines")
vm_response = list_vm[0]
self.assertEqual(vm_response.state, 'Running',
msg="VM is not in Running state")
return vm, vm_response.hostid
def test_01_list_aff_grps_for_vm(self):
@ -543,11 +529,6 @@ class TestDeleteAffinityGroups(cloudstackTestCase):
api_client = self.api_client
if aff_grp == None:
self.services["host_anti_affinity_0"]
#if acc == None:
# acc = self.account.name
#if domainid == None:
# domainid = self.domain.id
try:
self.aff_grp.append(AffinityGroup.create(api_client,
aff_grp, acc, domainid))
@ -555,22 +536,16 @@ class TestDeleteAffinityGroups(cloudstackTestCase):
raise Exception("Error: Creation of Affinity Group failed : %s" %e)
def create_vm_in_aff_grps(self, ag_list):
#try:
self.debug('Creating VM in AffinityGroup=%s' % ag_list[0])
vm = VirtualMachine.create(
self.api_client,
self.services["virtual_machine"],
templateid=self.template.id,
#accountid=self.account.name,
#domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
affinitygroupnames=ag_list
)
self.debug('Created VM=%s in Affinity Group=%s' %
(vm.id, ag_list[0]))
#except Exception:
#self.debug('Unable to create VM in a Affinity Group=%s'
# % ag_list[0])
list_vm = list_virtual_machines(self.api_client, id=vm.id)
@ -817,11 +792,6 @@ class TestUpdateVMAffinityGroups(cloudstackTestCase):
api_client = self.api_client
if aff_grp == None:
self.services["host_anti_affinity_0"]
#if acc == None:
# acc = self.account.name
#if domainid == None:
# domainid = self.domain.id
try:
self.aff_grp.append(AffinityGroup.create(api_client,
aff_grp, acc, domainid))
@ -829,22 +799,16 @@ class TestUpdateVMAffinityGroups(cloudstackTestCase):
raise Exception("Error: Creation of Affinity Group failed : %s" %e)
def create_vm_in_aff_grps(self, ag_list):
#try:
self.debug('Creating VM in AffinityGroup=%s' % ag_list[0])
vm = VirtualMachine.create(
self.api_client,
self.services["virtual_machine"],
templateid=self.template.id,
#accountid=self.account.name,
#domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
affinitygroupnames=ag_list
)
self.debug('Created VM=%s in Affinity Group=%s' %
(vm.id, ag_list[0]))
#except Exception:
#self.debug('Unable to create VM in a Affinity Group=%s'
# % ag_list[0])
list_vm = list_virtual_machines(self.api_client, id=vm.id)
@ -996,7 +960,7 @@ class TestUpdateVMAffinityGroups(cloudstackTestCase):
vm1.start(self.api_client)
list_aff_grps = AffinityGroup.list(self.api_client,
virtualmachineid=vm.id)
virtualmachineid=vm1.id)
self.assertEqual(list_aff_grps, [], "The affinity groups list is not empyty")
vm1.delete(self.api_client)
@ -1096,10 +1060,6 @@ class TestDeployVMAffinityGroups(cloudstackTestCase):
api_client = self.api_client
if aff_grp == None:
self.services["host_anti_affinity_0"]
#if acc == None:
# acc = self.account.name
#if domainid == None:
# domainid = self.domain.id
try:
self.aff_grp.append(AffinityGroup.create(api_client,
@ -1116,8 +1076,6 @@ class TestDeployVMAffinityGroups(cloudstackTestCase):
api_client,
self.services["virtual_machine"],
templateid=self.template.id,
#accountid=self.account.name,
#domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
affinitygroupnames=ag_list,
affinitygroupids=ag_ids
@ -1143,7 +1101,6 @@ class TestDeployVMAffinityGroups(cloudstackTestCase):
"""
Deploy VM without affinity group
"""
vm1, hostid1 = self.create_vm_in_aff_grps()
vm1.delete(self.api_client)
@ -1441,10 +1398,6 @@ class TestAffinityGroupsAdminUser(cloudstackTestCase):
api_client = self.api_client
if aff_grp == None:
self.services["host_anti_affinity_0"]
#if acc == None:
# acc = self.account.name
#if domainid == None:
# domainid = self.domain.id
try:
self.aff_grp.append(AffinityGroup.create(api_client,
@ -1461,8 +1414,6 @@ class TestAffinityGroupsAdminUser(cloudstackTestCase):
api_client,
self.services["virtual_machine"],
templateid=self.template.id,
#accountid=self.account.name,
#domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
affinitygroupnames=ag_list,
affinitygroupids=ag_ids

View File

@ -740,7 +740,7 @@ class TestNetScalerDedicated(cloudstackTestCase):
serviceofferingid=self.service_offering.id,
networkids=[str(self.network.id)]
)
self.debug("Deply instacne in dedicated Network offering mode failed")
self.debug("Deply instance in dedicated Network offering mode failed")
return

View File

@ -748,18 +748,6 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
account=cls.account.name,
domainid=cls.account.domainid
)
# cls.assertEqual(
# isinstance(public_ips, list),
# True,
# "List public Ip for network should list the Ip addr"
# )
# cls.assertEqual(
# public_ips[0].ipaddress,
# public_ip_2.ipaddress.ipaddress,
# "List public Ip for network should list the Ip addr"
# )
#
public_ip_3 = PublicIPAddress.create(
cls.apiclient,
accountid=cls.account.name,
@ -1031,7 +1019,6 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
self.validate_vpc_offering(self.vpc_off)
self.validate_vpc_network(self.vpc)
#self.validate_network_rules()
self.assertEqual(
isinstance(self.gateways, list),
True,
@ -1354,4 +1341,3 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
"is %s" % (router.serviceofferingid, service_offering.id)
)
return

View File

@ -837,13 +837,11 @@ class TestLoadBalancingRule(cloudstackTestCase):
))
self.try_ssh(src_nat_ip_addr, hostnames)
self.assertIn(
self.vm_1.name,
hostnames,
"Check if ssh succeeded for server1"
)
except Exception as e:
self.fail("%s: SSH failed for VM with IP Address: %s" %
(e, src_nat_ip_addr.ipaddress))
@ -988,15 +986,12 @@ class TestLoadBalancingRule(cloudstackTestCase):
hostnames[:] = []
self.try_ssh(self.non_src_nat_ip, hostnames)
self.assertIn(
self.vm_1.name,
hostnames,
"Check if ssh succeeded for server1"
)
self.debug("Hostnames after removing VM2: %s" % str(hostnames))
except Exception as e:
self.fail("%s: SSH failed for VM with IP Address: %s" %
(e, self.non_src_nat_ip.ipaddress.ipaddress))
@ -1017,7 +1012,6 @@ class TestLoadBalancingRule(cloudstackTestCase):
ssh_1.execute("hostname")[0]
return
class TestRebootRouter(cloudstackTestCase):
def setUp(self):
@ -1354,8 +1348,6 @@ class TestAssignRemoveLB(cloudstackTestCase):
hostnames,
"Check if ssh succeeded for server2"
)
#Removing VM and assigning another VM to LB rule
lb_rule.remove(self.apiclient, [self.vm_2])
@ -1375,7 +1367,6 @@ class TestAssignRemoveLB(cloudstackTestCase):
hostnames,
"Check if ssh succeeded for server1"
)
except Exception as e:
self.fail("SSH failed for VM with IP: %s" %
self.non_src_nat_ip.ipaddress)
@ -1384,13 +1375,11 @@ class TestAssignRemoveLB(cloudstackTestCase):
# Making hostnames list empty
hostnames[:] = []
self.try_ssh(self.non_src_nat_ip, hostnames)
self.try_ssh(self.non_src_nat_ip, hostnames)
self.try_ssh(self.non_src_nat_ip, hostnames)
self.try_ssh(self.non_src_nat_ip, hostnames)
self.try_ssh(self.non_src_nat_ip, hostnames)
self.debug("Hostnames: %s" % str(hostnames))
self.assertIn(
self.vm_1.name,

View File

@ -79,6 +79,7 @@ class Services:
}
class TestVmSnapshot(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestVmSnapshot, cls).getClsTestClient().getApiClient()