# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1236247828 28800
# Node ID c28d56459462006dfb3d0be33891ca6bc6015d85
# Parent c6f7256013b97dc57a31312897e45eb3cd8604a7
[TEST] Fix ElementCapabilities/03_forward_errs.py with provider's updated err message
Also fix the line to meet 80 length
Tested for KVM/LXC with current sources and rpm
Signed-off-by: Guolian Yun<yunguol(a)cn.ibm.com>
diff -r c6f7256013b9 -r c28d56459462
suites/libvirt-cim/cimtest/ElementCapabilities/03_forward_errs.py
--- a/suites/libvirt-cim/cimtest/ElementCapabilities/03_forward_errs.py Tue Mar 03
08:47:40 2009 -0800
+++ b/suites/libvirt-cim/cimtest/ElementCapabilities/03_forward_errs.py Thu Mar 05
02:10:28 2009 -0800
@@ -27,7 +27,7 @@
from XenKvmLib import enumclass
from XenKvmLib.classes import get_typed_class
from CimTest.Globals import logger, CIM_USER, CIM_PASS, CIM_NS
-from XenKvmLib.const import do_main
+from XenKvmLib.const import do_main, get_provider_version
from CimTest.ReturnCodes import PASS, FAIL
sup_types = ['Xen', 'XenFV', 'KVM', 'LXC']
@@ -42,23 +42,25 @@
status = FAIL
rc = -1
names = []
-
+ ec = get_typed_class(options.virt, "ElementCapabilities")
try:
- names = conn.AssociatorNames(ref, AssocClass = get_typed_class(options.virt,
"ElementCapabilities"))
+ names = conn.AssociatorNames(ref, AssocClass = ec)
rc = 0
except pywbem.CIMError, (rc, desc):
if rc == exp_rc and desc.find(exp_desc) >= 0:
logger.info("Got expected rc code and error string")
status = PASS
else:
- logger.error("Unexpected rc code %s and description %s\n", rc,
desc)
+ logger.error("Unexpected rc code %s and description %s\n", rc,
+ desc)
except Exception, details:
logger.error("Unknown exception happened")
logger.error(details)
if rc == 0:
- logger.error("ElementCapabilities associator should NOT return excepted \
- result with a wrong key name and value of %s input",
ref_class)
+ logger.error("ElementCapabilities associator should NOT return \
+ exceptet result with a wrong key name and value \
+ of %s input", ref_class)
status = FAIL
return status
@@ -73,7 +75,8 @@
cs = get_typed_class(options.virt, "ComputerSystem")
instanceref = CIMInstanceName(hs,
- keybindings = {"Name" : "wrong",
"CreationClassName" : "wrong"})
+ keybindings = {"Name" : "wrong",
+ "CreationClassName" : "wrong"})
rc = try_assoc(instanceref, hs, exp_rc, exp_desc, options)
if rc != PASS:
@@ -81,8 +84,16 @@
return status
instance_cs = CIMInstanceName(cs,
- keybindings = {"Name" : "wrong",
"CreationClassName" : "Xen_ComputerSystem"})
- rc = try_assoc(instance_cs, cs, exp_rc, exp_desc, options)
+ keybindings = {"Name" : "wrong",
+ "CreationClassName" :
"Xen_ComputerSystem"})
+
+ curr_cim_rev, changeset = get_provider_version(options.virt, options.ip)
+ if curr_cim_rev >= 815:
+ cs_exp_desc = "Referenced domain `wrong' does not exist: \
+Domain not found"
+ try_assoc(instance_cs, cs, exp_rc, cs_exp_desc, options)
+ else:
+ rc = try_assoc(instance_cs, cs, exp_rc, exp_desc, options)
if rc != PASS:
status = FAIL
return status