[Libvirt-cim] [PATCH 3 of 9] [TEST] Update HostedService tests to expect an instance from get_host_info()

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


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1226705449 28800
# Node ID aca519aaabf055d41e3b721bd5917d0086efccd5
# Parent  0967f6e02888cb791e5a69404bae89dffc332d5c
[TEST] Update HostedService tests to expect an 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 0967f6e02888 -r aca519aaabf0 suites/libvirt-cim/cimtest/HostedService/01_forward.py
--- a/suites/libvirt-cim/cimtest/HostedService/01_forward.py	Fri Nov 14 15:30:49 2008 -0800
+++ b/suites/libvirt-cim/cimtest/HostedService/01_forward.py	Fri Nov 14 15:30:49 2008 -0800
@@ -30,12 +30,11 @@
 from CimTest import Globals
 from XenKvmLib.const import do_main
 from CimTest.Globals import logger
-from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
+from CimTest.ReturnCodes import PASS, FAIL
 from XenKvmLib.common_util import get_host_info
 from XenKvmLib.const import get_provider_version
 
 sup_types = ['Xen', 'XenFV', 'KVM', 'LXC']
-bug_sblim = '00007'
 libvirtcim_hr_crs_changes = 695
 
 @do_main(sup_types)
@@ -44,16 +43,20 @@
     virt = options.virt
     server = options.ip
     try:
-        status, host_name, host_ccn = get_host_info(server, virt)
+        status, host_inst = get_host_info(server, virt)
         if status != PASS:
             logger.error("Failed to get host info.")
             return status
+
+        host_ccn = host_inst.CreationClassName
+        host_name = host_inst.Name
 
         an = get_typed_class(virt, "HostedService")
         service = assoc.AssociatorNames(server,
                                         an, host_ccn,
                                         CreationClassName = host_ccn,
                                         Name = host_name)
+
     except Exception, deatils:
         logger.error(Globals.CIM_ERROR_ASSOCIATORNAMES % host_name)
         logger.error("Exception: details %s", details)
@@ -82,13 +85,9 @@
     ccn_list = Set(ccn_list) 
  
     if len((val_serv) - (ccn_list)) != 0:
-        if host_ccn == 'Linux_ComputerSystem':
-            return XFAIL_RC(bug_sblim)
-        else:
-
-            logger.error("Mismatching services values")
-            logger.error("'%s' returned %d, expected %d", 
-                         an, len(ccn_list), len(val_serv))
+        logger.error("Mismatching services values")
+        logger.error("'%s' returned %d, expected %d", 
+                     an, len(ccn_list), len(val_serv))
         return FAIL
 
     return PASS 
diff -r 0967f6e02888 -r aca519aaabf0 suites/libvirt-cim/cimtest/HostedService/02_reverse.py
--- a/suites/libvirt-cim/cimtest/HostedService/02_reverse.py	Fri Nov 14 15:30:49 2008 -0800
+++ b/suites/libvirt-cim/cimtest/HostedService/02_reverse.py	Fri Nov 14 15:30:49 2008 -0800
@@ -52,11 +52,14 @@
     if cim_rev >= libvirtcim_hr_crs_changes:   
         servicelist['ConsoleRedirectionService'] =  "ConsoleRedirectionService"
 
-    status, host_name, host_ccn = get_host_info(server, virt)
+    status, host_inst = get_host_info(server, virt)
     if status != PASS:
         logger.error("Failed to get host info.")
         return status
     
+    host_ccn = host_inst.CreationClassName
+    host_name = host_inst.Name
+
     an = get_typed_class(virt, "HostedService")
     for k, v in servicelist.iteritems():
         cn = get_typed_class(virt, k)
diff -r 0967f6e02888 -r aca519aaabf0 suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py
--- a/suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py	Fri Nov 14 15:30:49 2008 -0800
+++ b/suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py	Fri Nov 14 15:30:49 2008 -0800
@@ -30,9 +30,8 @@
 from CimTest.Globals import logger, CIM_ERROR_ENUMERATE, CIM_USER, \
                             CIM_PASS, CIM_NS
 from XenKvmLib.const import do_main
-from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
+from CimTest.ReturnCodes import PASS, FAIL
 
-bug = '00007'
 sup_types = ['Xen', 'XenFV', 'KVM', 'LXC']
 exp_values = {
               "invalid_ccname" : {"rc" : pywbem.CIM_ERR_NOT_FOUND, \
@@ -47,12 +46,23 @@
     rc = -1
     status = FAIL
     keys = ['Name', 'CreationClassName']
-    status, host_name, host_ccn = 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_ccn = host_inst.CreationClassName
+    host_name = host_inst.Name
+    
+    if (host_ccn == "Linux_ComputerSystem"):
+        exp_values['invalid_ccname'] = {"rc" : pywbem.CIM_ERR_INVALID_PARAMETER,
+                                        "desc" : "Linux_ComputerSystem"
+                                       } 
+        exp_values['invalid_name'] = {"rc" : pywbem.CIM_ERR_INVALID_PARAMETER,
+                                        "desc" : "Linux_ComputerSystem"
+                                       } 
+
     conn = assoc.myWBEMConnection('http://%s' % options.ip,                                        
                                   (CIM_USER, CIM_PASS),
                                    CIM_NS)
@@ -62,21 +72,15 @@
     ret =  try_assoc(conn, host_ccn, assoc_classname, keys, "Name", \
                      exp_values['invalid_name'], bug_no="")
     if ret != PASS:
-        if host_ccn == 'Linux_ComputerSystem':
-            return XFAIL_RC(bug)
-        else:
-            logger.error("------ FAILED: Invalid Name Key Name.------")
-            return FAIL
+        logger.error("------ FAILED: Invalid Name Key Name.------")
+        return FAIL
 
     keys = {"Name" : host_name, "Wrong" : host_ccn}
     ret = try_assoc(conn, host_ccn, assoc_classname, keys, "CreationClassName", \
                     exp_values['invalid_ccname'], bug_no="")
     if ret != PASS:
-        if host_ccn ==  'Linux_ComputerSystem':
-             return XFAIL_RC(bug)
-        else:
-            logger.error("------ FAILED: Invalid CreationClassName Key Name.------")
-            return FAIL
+        logger.error("------ FAILED: Invalid CreationClassName Key Name.------")
+        return FAIL
 
 
     return status        
diff -r 0967f6e02888 -r aca519aaabf0 suites/libvirt-cim/cimtest/HostedService/04_reverse_errs.py
--- a/suites/libvirt-cim/cimtest/HostedService/04_reverse_errs.py	Fri Nov 14 15:30:49 2008 -0800
+++ b/suites/libvirt-cim/cimtest/HostedService/04_reverse_errs.py	Fri Nov 14 15:30:49 2008 -0800
@@ -45,10 +45,13 @@
     options = main.options
     status = FAIL
     keys = ['Name', 'CreationClassName']
-    status, host_name, host_ccn = 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_ccn = host_inst.CreationClassName
+    host_name = host_inst.Name
 
     rpcs = get_typed_class(options.virt, "ResourcePoolConfigurationService")
     vsms = get_typed_class(options.virt, "VirtualSystemManagementService")




More information about the Libvirt-cim mailing list