CLOUDSTACK-7330: Fixing ListNetworks issue in test_portable_ip.py

Signed-off-by: Santhosh Edukulla <santhosh.edukulla@gmail.com>
This commit is contained in:
Gaurav Aradhye 2014-08-13 16:12:17 +05:30 committed by Santhosh Edukulla
parent 3c9d78752d
commit b7c4259d97
2 changed files with 6 additions and 11 deletions

View File

@ -1721,13 +1721,6 @@ class TestVPCNetworkOperations(cloudstackTestCase):
self.assertEqual(validateList(networks)[0], FAIL, "networks list should be empty, it is %s" % networks) self.assertEqual(validateList(networks)[0], FAIL, "networks list should be empty, it is %s" % networks)
return return
def VerifyDomainCleanup(self, domainid):
"""Verify that domain is cleaned up"""
domains=Domain.list(self.apiclient,id=domainid)
self.assertEqual(validateList(domains)[0], FAIL, "domains list should be empty, it is %s" % domains)
return
def VerifyVpcCleanup(self, vpcid): def VerifyVpcCleanup(self, vpcid):
"""Verify that VPC is cleaned up""" """Verify that VPC is cleaned up"""
vpcs = VPC.list(self.apiclient,id=vpcid) vpcs = VPC.list(self.apiclient,id=vpcid)
@ -1931,7 +1924,9 @@ class TestVPCNetworkOperations(cloudstackTestCase):
" to cleanup any remaining resouces") " to cleanup any remaining resouces")
# Sleep 3*account.gc to ensure that all resources are deleted # Sleep 3*account.gc to ensure that all resources are deleted
wait_for_cleanup(self.apiclient, ["account.cleanup.interval"]*3) wait_for_cleanup(self.apiclient, ["account.cleanup.interval"]*3)
self.VerifyDomainCleanup(child_domain.id)
with self.assertRaises(Exception):
Domain.list(self.apiclient,id=child_domain.id)
with self.assertRaises(Exception): with self.assertRaises(Exception):
Account.list( Account.list(
@ -1947,7 +1942,7 @@ class TestVPCNetworkOperations(cloudstackTestCase):
self.VerifyVpcCleanup(vpc_1.id) self.VerifyVpcCleanup(vpc_1.id)
self.VerifyVpcCleanup(vpc_2.id) self.VerifyVpcCleanup(vpc_2.id)
self.VerifyNetworkClenaup(persistent_network_1.id) self.VerifyNetworkCleanup(persistent_network_1.id)
self.VerifyNetworkCleanup(persistent_network_2.id) self.VerifyNetworkCleanup(persistent_network_2.id)
return return

View File

@ -1151,7 +1151,7 @@ def shouldTestBeSkipped(networkType, zoneType):
skipIt = True skipIt = True
return skipIt return skipIt
def verifyNetworkState(apiclient, networkid, state): def verifyNetworkState(apiclient, networkid, state, listall=True):
"""List networks and check if the network state matches the given state""" """List networks and check if the network state matches the given state"""
retriesCount = 10 retriesCount = 10
isNetworkInDesiredState = False isNetworkInDesiredState = False
@ -1159,7 +1159,7 @@ def verifyNetworkState(apiclient, networkid, state):
exceptionMessage = "" exceptionMessage = ""
try: try:
while retriesCount >= 0: while retriesCount >= 0:
networks = Network.list(apiclient, id=networkid) networks = Network.list(apiclient, id=networkid, listall=listall)
assert validateList( assert validateList(
networks)[0] == PASS, "Networks list validation failed" networks)[0] == PASS, "Networks list validation failed"
if str(networks[0].state).lower() == state: if str(networks[0].state).lower() == state: