[Libvirt-cim] [PATCH] [TEST] #2 Fix a false positive in HostedResourcePool/01_forward.py
Kaitlin Rupert
kaitlin at linux.vnet.ibm.com
Thu Oct 9 15:09:59 UTC 2008
> + try:
> + for items in pool:
> + cname = items.classname
> + if cname.find("MemoryPool") >=0 and items['InstanceID'] == "MemoryPool/0":
> + status = PASS
> + elif cname.find("ProcessorPool") >=0 and items['InstanceID'] == "ProcessorPool/0":
> + status = PASS
> + elif cname.find("NetworkPool") >=0 and \
> + items['InstanceID'] == "NetworkPool/%s" %default_network_name:
> + status = PASS
> + elif cname.find("DiskPool") >=0 and \
> + items['InstanceID'] == "DiskPool/%s" % default_pool_name:
> + status = PASS
> + except Exception, details:
> + logger.error(details)
> + return FAIL
>
If one of the if conditions fail, you'll want to return from the test
instead of checking the next condition. So you can change this to
something like:
try:
for items in pool:
cname = items.classname
if cname.find("MemoryPool") >=0 and items['InstanceID'] !=
"MemoryPool/0":
raise Exception("%s does not match MemoryPool/0",
items['InstanceID'])
elif cname.find("ProcessorPool") >=0 and items['InstanceID'] !=
"ProcessorPool/0":
raise Exception("%s does not match ProcessorPool/0",
items['InstanceID'])
elif cname.find("NetworkPool") >= 0 and \
items['InstanceID'] != "NetworkPool/%s" %default_network_name:
raise Exception("%s does not match NetworkPool/%s",
items['InstanceID'], default_network_name)
elif cname.find("DiskPool") >= 0 and \
items['InstanceID'] != "DiskPool/%s" % default_pool_name:
raise Exception("%s does not match DiskPool/%s",
items['InstanceID'], default_pool_name)
except Exception, details:
logger.error(details)
return FAIL
return PASS
--
Kaitlin Rupert
IBM Linux Technology Center
kaitlin at linux.vnet.ibm.com
More information about the Libvirt-cim
mailing list