[Libvirt-cim] [PATCH 6 of 9] [TEST] Update HostedResourcePool tests to expect instance from get_host_info()

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Mon Nov 17 21:10:33 UTC 2008


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1226705451 28800
# Node ID 5f39bb761dcb4526e8b43fb6a89a3a7e61589fb1
# Parent  5466028a80608d44d61b06c3e38d5ef395cad169
[TEST] Update HostedResourcePool tests to expect instance from get_host_info().

Also remove XFAILs as these tests should pass now.

Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>

diff -r 5466028a8060 -r 5f39bb761dcb suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py
--- a/suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py	Fri Nov 14 15:30:50 2008 -0800
+++ b/suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py	Fri Nov 14 15:30:51 2008 -0800
@@ -31,21 +31,24 @@
 from XenKvmLib.const import default_network_name
 from CimTest import Globals
 from CimTest.Globals import logger
-from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
+from CimTest.ReturnCodes import PASS, FAIL
 from XenKvmLib.const import do_main, default_pool_name
 from XenKvmLib.classes import get_typed_class
 
-bug = '00007'
 sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
 @do_main(sup_types)
 def main():
     options = main.options
     virt = options.virt
     keys = ['Name', 'CreationClassName']
-    status, host_sys, host_cn = get_host_info(options.ip, virt)
+    status, host_inst = get_host_info(options.ip, virt)
     if status != PASS:
         logger.error("Error in calling get_host_info function")
         return FAIL
+
+    host_cn = host_inst.CreationClassName
+    host_sys = host_inst.Name
+
     try:
         assoc_cn = get_typed_class(virt, "HostedResourcePool")
         pool = assoc.AssociatorNames(options.ip,
@@ -62,11 +65,8 @@
         logger.error("System association failed")
         return FAIL
     elif len(pool) == 0:
-        if host_cn == 'Linux_ComputerSystem':
-            return XFAIL_RC(bug)
-        else:
-            logger.error("No pool returned")
-            return FAIL
+        logger.error("No pool returned")
+        return FAIL
 
     mpool =  get_typed_class(virt, 'MemoryPool')
     exp_pllist = { mpool   : ['MemoryPool/0'] }
diff -r 5466028a8060 -r 5f39bb761dcb suites/libvirt-cim/cimtest/HostedResourcePool/02_reverse.py
--- a/suites/libvirt-cim/cimtest/HostedResourcePool/02_reverse.py	Fri Nov 14 15:30:50 2008 -0800
+++ b/suites/libvirt-cim/cimtest/HostedResourcePool/02_reverse.py	Fri Nov 14 15:30:51 2008 -0800
@@ -40,10 +40,13 @@
     status = PASS
 
     keys = ['Name', 'CreationClassName']
-    status, host_sys, host_cn = get_host_info(options.ip, options.virt)
+    status, host_inst = get_host_info(options.ip, options.virt)
     if status != PASS:
         logger.error("Error in calling get_host_info function")
         return FAIL
+
+    host_cn = host_inst.CreationClassName
+    host_sys = host_inst.Name
 
     assoc_cn = get_typed_class(options.virt, "HostedResourcePool")
     proc_cn  = get_typed_class(options.virt, "ProcessorPool")
diff -r 5466028a8060 -r 5f39bb761dcb suites/libvirt-cim/cimtest/HostedResourcePool/03_forward_errs.py
--- a/suites/libvirt-cim/cimtest/HostedResourcePool/03_forward_errs.py	Fri Nov 14 15:30:50 2008 -0800
+++ b/suites/libvirt-cim/cimtest/HostedResourcePool/03_forward_errs.py	Fri Nov 14 15:30:51 2008 -0800
@@ -29,11 +29,10 @@
 from XenKvmLib.common_util import try_assoc
 from CimTest import Globals
 from CimTest.Globals import logger
-from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
+from CimTest.ReturnCodes import PASS, FAIL
 from XenKvmLib.const import do_main
 from XenKvmLib.classes import get_typed_class
 
-bug = "00007"
 expr_values = {
         "invalid_ccname" : {"rc" : pywbem.CIM_ERR_NOT_FOUND, 
                   "desc" : "No such instance (CreationClassName)"},
@@ -46,7 +45,7 @@
 def main():
     options = main.options
     keys = ['Name', 'CreationClassName']
-    status, host_sys, host_cn = get_host_info(options.ip, options.virt)
+    status, host_inst = get_host_info(options.ip, options.virt)
     if status != PASS:
         logger.error("Error in calling get_host_info function")
         return FAIL
@@ -54,27 +53,28 @@
     conn = assoc.myWBEMConnection('http://%s' % options.ip,                                        
                                   (Globals.CIM_USER, Globals.CIM_PASS),
                                                        Globals.CIM_NS)
-    classname = host_cn
+    host_cn = host_inst.CreationClassName
+    host_sys = host_inst.Name
+
+    if (host_cn == "Linux_ComputerSystem"):
+        sblim_rc = pywbem.CIM_ERR_INVALID_PARAMETER
+        expr_values['invalid_ccname'] = {"rc" : sblim_rc, "desc" : "wrong"}
+        expr_values['invalid_name'] = {"rc" : sblim_rc, "desc" : "wrong"}
+
     assoc_classname = get_typed_class(options.virt, "HostedResourcePool")
     keys = {"Name" : host_sys, "CreationClassName" : "wrong"}
-    ret =  try_assoc(conn, classname, assoc_classname, keys, 
+    ret =  try_assoc(conn, host_cn, assoc_classname, keys, 
                      "Name", expr_values['invalid_ccname'], bug_no="")
     if ret != PASS:
-        if host_cn == 'Linux_ComputerSystem':
-            return XFAIL_RC(bug)
-        else:
-            logger.error("------ FAILED: Invalid CreationClassName Key Value.------")
-            return FAIL
+        logger.error("------FAILED: Invalid CreationClassName Key Value.------")
+        return FAIL
 
     keys = {"Name" : "wrong", "CreationClassName" : host_cn}
-    ret = try_assoc(conn, classname, assoc_classname, keys, 
+    ret = try_assoc(conn, host_cn, assoc_classname, keys, 
                   "CreationClassName", expr_values['invalid_name'], bug_no="")
     if ret != PASS:
-        if host_cn == 'Linux_ComputerSystem':
-            return XFAIL_RC(bug)
-        else:
-            logger.error("------ FAILED: Invalid Name Key Value.------")
-            return FAIL
+        logger.error("------ FAILED: Invalid Name Key Value.------")
+        return FAIL
 
     return PASS
 if __name__ == "__main__":




More information about the Libvirt-cim mailing list