[PATCH] [TEST] Remove log info to the right place

# HG changeset patch # User Guolian Yun <yunguol@cn.ibm.com> # Date 1228719139 28800 # Node ID 53c3639c9f6db35026fa06cfda94171ecef9d3ed # Parent 701f3228bdfe740f4a504dce1dfab844c812b9d5 [TEST] Remove log info to the right place Signed-off-by: Guolian Yun <yunguol@cn.ibm.com> diff -r 701f3228bdfe -r 53c3639c9f6d suites/libvirt-cim/cimtest/ElementConforms/01_forward.py --- a/suites/libvirt-cim/cimtest/ElementConforms/01_forward.py Wed Dec 03 21:31:09 2008 -0800 +++ b/suites/libvirt-cim/cimtest/ElementConforms/01_forward.py Sun Dec 07 22:52:19 2008 -0800 @@ -93,13 +93,14 @@ if assoc_val.items() == ele.items(): managed_ele_values[cn].remove(ele) return PASS, managed_ele_values + else: + logger.error("%s not in expected list %s", assoc_val, elements) + return FAIL, managed_ele_values except Exception, details: logger.error("verify_fields() exception: %s", details) return FAIL, managed_ele_values - logger.error("%s not in expected list %s", assoc_val, elements) - return FAIL, managed_ele_values def get_proflist(server, reg_classname, virt): profiles_instid_list = []

yunguol@cn.ibm.com wrote:
# HG changeset patch # User Guolian Yun <yunguol@cn.ibm.com> # Date 1228719139 28800 # Node ID 53c3639c9f6db35026fa06cfda94171ecef9d3ed # Parent 701f3228bdfe740f4a504dce1dfab844c812b9d5 [TEST] Remove log info to the right place
Signed-off-by: Guolian Yun <yunguol@cn.ibm.com>
diff -r 701f3228bdfe -r 53c3639c9f6d suites/libvirt-cim/cimtest/ElementConforms/01_forward.py --- a/suites/libvirt-cim/cimtest/ElementConforms/01_forward.py Wed Dec 03 21:31:09 2008 -0800 +++ b/suites/libvirt-cim/cimtest/ElementConforms/01_forward.py Sun Dec 07 22:52:19 2008 -0800 @@ -93,13 +93,14 @@ if assoc_val.items() == ele.items(): managed_ele_values[cn].remove(ele) return PASS, managed_ele_values + else: + logger.error("%s not in expected list %s", assoc_val, elements) + return FAIL, managed_ele_values
This isn't a valid change. If your system has multiple diskpools defined, the first item in elements might not be the pool you were attempting to verify. So the loop could look like this: elements = [bootvirtimages, cimtest-diskpool] for ele in elements: if assoc_val.items() == ele.items(): The attributes of bootvirtimages won't match the attributes of the cimtest-diskpool (which is the diskpool instance we're looking for). So if you put an else here, we return a failure incorrectly.
except Exception, details: logger.error("verify_fields() exception: %s", details) return FAIL, managed_ele_values
- logger.error("%s not in expected list %s", assoc_val, elements) - return FAIL, managed_ele_values
With the return left here as is, we loop through all the items in elements. If we don't find a match, we return a failure. -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com

libvirt-cim-bounces@redhat.com wrote on 2008-12-09 03:03:21:
yunguol@cn.ibm.com wrote:
# HG changeset patch # User Guolian Yun <yunguol@cn.ibm.com> # Date 1228719139 28800 # Node ID 53c3639c9f6db35026fa06cfda94171ecef9d3ed # Parent 701f3228bdfe740f4a504dce1dfab844c812b9d5 [TEST] Remove log info to the right place
Signed-off-by: Guolian Yun <yunguol@cn.ibm.com>
diff -r 701f3228bdfe -r 53c3639c9f6d suites/libvirt- cim/cimtest/ElementConforms/01_forward.py --- a/suites/libvirt-cim/cimtest/ElementConforms/01_forward.py Wed Dec 03 21:31:09 2008 -0800 +++ b/suites/libvirt-cim/cimtest/ElementConforms/01_forward.py Sun Dec 07 22:52:19 2008 -0800 @@ -93,13 +93,14 @@ if assoc_val.items() == ele.items(): managed_ele_values[cn].remove(ele) return PASS, managed_ele_values + else: + logger.error("%s not in expected list %s", assoc_val, elements) + return FAIL, managed_ele_values
This test fails when cn == "KVM_HostSystem", which report below: CIMInstance(classname=u'KVM_HostSystem', ...) not in expected list [] Here is the output of managed_ele_values: {'KVM_ComputerSystem': [], 'KVM_VirtualSystemMigrationService': [], 'KVM_MemoryPool': [], 'KVM_DiskPool': [], u'KVM_HostSystem': [], 'KVM_NetworkPool': [], 'KVM_ProcessorPool': []} Do you know why it is? Thanks!
This isn't a valid change. If your system has multiple diskpools defined, the first item in elements might not be the pool you were attempting to verify.
So the loop could look like this:
elements = [bootvirtimages, cimtest-diskpool] for ele in elements: if assoc_val.items() == ele.items():
The attributes of bootvirtimages won't match the attributes of the cimtest-diskpool (which is the diskpool instance we're looking for).
So if you put an else here, we return a failure incorrectly.
except Exception, details: logger.error("verify_fields() exception: %s", details) return FAIL, managed_ele_values
- logger.error("%s not in expected list %s", assoc_val, elements) - return FAIL, managed_ele_values
With the return left here as is, we loop through all the items in elements. If we don't find a match, we return a failure.
-- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim

This test fails when cn == "KVM_HostSystem", which report below: CIMInstance(classname=u'KVM_HostSystem', ...) not in expected list []
Here is the output of managed_ele_values: {'KVM_ComputerSystem': [], 'KVM_VirtualSystemMigrationService': [], 'KVM_MemoryPool': [], 'KVM_DiskPool': [], u'KVM_HostSystem': [], 'KVM_NetworkPool': [], 'KVM_ProcessorPool': []}
Do you know why it is? Thanks!
I sent a patch to fix this issue. -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
participants (3)
-
Guo Lian Yun
-
Kaitlin Rupert
-
yunguol@cn.ibm.com