libvirt-cim-bounces@redhat.com wrote on 2008-09-29 19:36:20:

>
>
> yunguol@cn.ibm.com wrote:
> >      
> > diff -r 0ecb3a22c361 -r 145cde258442 suites/libvirt-
> cim/cimtest/HostedService/03_forward_errs.py
> > --- a/suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py
> Fri Sep 26 02:44:52 2008 -0700
> > +++ b/suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py
> Fri Sep 26 19:29:43 2008 -0700
> > @@ -25,6 +25,7 @@ from pywbem.cim_obj import CIMInstanceNa
> >  from pywbem.cim_obj import CIMInstanceName
> >  from XenKvmLib import assoc
> >  from XenKvmLib import enumclass
> > +from XenKvmLib.common_util import get_host_info
> >  from XenKvmLib.classes import get_typed_class
> >  from CimTest.Globals import logger, CIM_ERROR_ENUMERATE, CIM_USER, \
> >                              CIM_PASS, CIM_NS
> > @@ -40,24 +41,22 @@ def main():
> >      options = main.options
> >      rc = -1
> >      status = FAIL
> > -    keys = ['Name', 'CreationClassName']
> > -    try:
> > -        host_sys = enumclass.enumerate(options.ip, 'HostSystem',
> keys, options.virt)[0]
> > -    except Exception:
> > -        logger.error(CIM_ERROR_ENUMERATE % host_sys.name)
> > +    status, host_name, host_ccn = get_host_info(options.ip, options.virt)
> > +    if status != PASS:
> > +        logger.error("Error in calling get_host_info function")
> >          return FAIL
> > -
> > -    
> > +
> >      conn = assoc.myWBEMConnection('http://%s' % options.ip,              
> >                                    (CIM_USER, CIM_PASS),
> >                                     CIM_NS)
> >      instanceref = CIMInstanceName(get_typed_class(options.virt,
> "HostSystem"),
> > -                                  keybindings = {"Wrong" :
> "wrong", "CreationClassName" : host_sys.CreationClassName})
> > +                                  keybindings = {"Wrong" : "wrong", \
> > +                                  "CreationClassName" : host_ccn})
> >
> >      names = []
> > -
> > +    assoc_class = get_typed_class(options.virt, "HostedService")
> >      try:
> > -        names = conn.AssociatorNames(instanceref, AssocClass =
> get_typed_class(options.virt, "HostedService"))
> > +        names = conn.AssociatorNames(instanceref, AssocClass = assoc_class)
> >          rc = 0
> >      except pywbem.CIMError, (rc, desc):
> >          if rc == exp_rc and desc.find(exp_desc) >= 0:
> > @@ -70,7 +69,8 @@ def main():
> >          logger.error(details)
> >
> >      if rc == 0:
> > -        logger.error("HostedService associator should NOT return
> excepted result with a wrong key name and value of HostSystem input")
> > +        logger.error("HostedService associator should NOT return
> excepted result\
> > +                      with a wrong key name and value of HostSystem input")
> >          status = FAIL
> >      
> >      return status        
> >  
> The above test case passes with false positive.
> The existing test case is intended to verify for exception when a wrong
> Name is passed as a parameter.
> _
> For ex: without the sblim-base-provider the tc would be checking_
> wbemcli ain -ac Xen_HostedService
> 'http://root:p@localhost:5988/root/virt:Xen_HostSystem.
> CreationClassName="Xen_HostSystem",Wrong="wrong"'
> *
> * wbemcli: Cim: (6) CIM_ERR_NOT_FOUND: No such instance (Name)
> *
>
> _But with the sblim-base-provider installed the tc would be checking_
>
> wbemcli ain -ac Xen_HostedService
> 'http://root:P@localhost:5988/root/virt:Xen_HostSystem.
> CreationClassName="Linux_ComputerSystem",Wrong="wrong"'
> *
> * wbemcli: Cim: (6) CIM_ERR_NOT_FOUND: No such instance (CreationClassName)
> *
>
> though getting the exception for Linux_ComputerSystem in the second case
> is valid for now, as the query with the Linux_CS does not work yet,
> but this is not the expected behavior of the test case.
>
> The tc just verifies only "No such instance " string which is present in
> both the exceptions and hence passes.
> 1) This test cannot be supported to work with sblim-base-provider
> installed yet.
> 2) We need to update the tc to verify the case where we pass Invalid
> CreationClassName.
> 3) We need to be verifying the complete exception instead of just
> verifying part of it.
>

  Good catch - Deepti.
  I have update the tc to verify the complete exceptions for both HostedService03&04,
  also  HostedService-03 to verify the case when we pass invalid CreationClassName.
  On HostedService-04, follow patch will to verify other invalid properties except invalid
  Name.

  Thanks!
 

> Thanks and Regards,
> Deepti.
>
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim@redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim