[PATCH 0 of 2] [TEST] bundles of ComputerSystemCreatedIndication tc

the need patch of indication_tester is in libcmpiutil tree, you can copy it to cimtest lib make ComputerSystmeCreatedIndication tc work Signed-off-by: Guolian Yun <yunguol@cn.ibm.com>

# HG changeset patch # User Guolian Yun <yunguol@cn.ibm.com> # Date 1207017308 25200 # Node ID 3ea353d2ace40242b044254a865335f8523e00bf # Parent 5d47437104551b638aa75e2e525e49ec4b41e3ec [TEST] add default value setting for indication test case Signed-off-by: Guolian Yun <yunguol@cn.ibm.com> diff -r 5d4743710455 -r 3ea353d2ace4 suites/libvirt-cim/lib/XenKvmLib/vxml.py --- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Mon Mar 31 07:54:19 2008 -0700 +++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Mon Mar 31 19:35:08 2008 -0700 @@ -37,7 +37,7 @@ from xml import xpath from xml import xpath from VirtLib import utils, live from XenKvmLib.test_doms import set_uuid -from CimTest.Globals import logger, CIM_IP +from CimTest.Globals import logger, CIM_IP, CIM_PORT, CIM_NS, CIM_USER, CIM_PASS from CimTest.ReturnCodes import SKIP from XenKvmLib.classes import virt_types @@ -548,3 +548,17 @@ def get_class(virt): if virt in virt_types: return eval(virt + 'XML') +def set_default(server): + dict = {} + dict['default_sysname'] = live.full_hostname(server) + dict['default_port'] = CIM_PORT + dict['default_url'] = "%s:%s" % (dict['default_sysname'], dict['default_port']) + dict['default_ns'] = CIM_NS + dict['default_name'] = "Test" + dict['default_dump'] = False + dict['default_print_ind'] = False + dict['default_username'] = CIM_USER + dict['default_password'] = CIM_PASS + dict['default_auth'] = (dict['default_username'], dict['default_password']) + + return dict

# HG changeset patch # User Guolian Yun <yunguol@cn.ibm.com> # Date 1207017464 25200 # Node ID 7d8f3365c85f2793520086615d2ea93cc876d708 # Parent 3ea353d2ace40242b044254a865335f8523e00bf [TEST] add ComputerSystemCreatedIndication test case Signed-off-by: Guolian Yun <yunguol@cn.ibm.com> diff -r 3ea353d2ace4 -r 7d8f3365c85f suites/libvirt-cim/cimtest/ComputerSystemIndication/01_created_indication.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/suites/libvirt-cim/cimtest/ComputerSystemIndication/01_created_indication.py Mon Mar 31 19:37:44 2008 -0700 @@ -0,0 +1,92 @@ +#!/usr/bin/python +# +# Copyright 2008 IBM Corp. +# +# Authors: +# Guolian Yun <yunguol@cn.ibm.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +import sys +import os +import signal +import time +from CimTest.Globals import log_param, logger +from CimTest.Globals import do_main +from CimTest.ReturnCodes import PASS, FAIL +from XenKvmLib.common_util import create_using_definesystem +from XenKvmLib.test_doms import undefine_test_domain +from XenKvmLib.classes import get_typed_class +from XenKvmLib.indication_tester import CIMIndicationSubscription +from XenKvmLib.vxml import set_default + +SUPPORTED_TYPES = ['Xen', 'XenFV', 'KVM'] + +test_dom = "domU" + +@do_main(SUPPORTED_TYPES) +def main(): + options = main.options + log_param() + status = FAIL + + dict = set_default(options.ip) + indication_name = get_typed_class(options.virt, 'ComputerSystemCreatedIndication') + + sub = CIMIndicationSubscription(dict['default_name'], indication_name, dict['default_ns'], + dict['default_print_ind'], dict['default_sysname']) + sub.subscribe(dict['default_url'], dict['default_auth']) + logger.info("Watching for %s" % indication_name) + + try: + pid = os.fork() + if pid == 0: + sub.server.handle_request() + if len(sub.server.indications) == 0: + logger.error("No valid indications received") + sys.exit(1) + elif str(sub.server.indications[0]) != indication_name: + logger.error("Received indication %s instead of %s" % (indication_name, str(sub.server.indications[0]))) + sys.exit(2) + else: + sys.exit(0) + else: + create_using_definesystem(test_dom, options.ip, None, None, options.virt) + for i in range(0,100): + pw = os.waitpid(pid, os.WNOHANG)[1] + if pw == 0: + logger.info("Great, got indication successfuly") + status = PASS + break + elif pw == 1 and i < 99: + logger.info("still in child process, waiting for indication") + time.sleep(1) + else: + logger.error("Received indication error or wait too long") + break + except Exception, details: + logger.error("Unknown exception happened") + logger.error(details) + finally: + sub.unsubscribe(dict['default_auth']) + logger.info("Cancelling subscription for %s" % indication_name) + os.kill(pid, signal.SIGKILL) + undefine_test_domain(test_dom, options.ip, options.virt) + + return status + +if __name__=="__main__": + sys.exit(main())

Did you change this set or were you just resending because I didn't apply? I'm waiting for some review comments... -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com

libvirt-cim-bounces@redhat.com wrote on 2008-04-01 21:33:44:
Did you change this set or were you just resending because I didn't apply? I'm waiting for some review comments...
With the changed indication_tester, I think maybe it's better to resubmit this set. Of course, the same as former.
-- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com [attachment "atti4zoe.dat" deleted by Guo Lian Yun/China/IBM] _______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim

GY> With the changed indication_tester, I think maybe it's better to GY> resubmit this set. Of course, the same as former. Okay, I copied the indication_tester.py into the library and was able to run the indication test successfully. Very cool. What are your plans for other indication tests? We definitely need to test at least all three of the lifecycle indications in the positive case. How about a test that subscribes to a Xen indication and then creates a KVM guest to make sure that it doesn't get the KVM indication? -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com

libvirt-cim-bounces@redhat.com wrote on 2008-04-03 00:34:25:
GY> With the changed indication_tester, I think maybe it's better to GY> resubmit this set. Of course, the same as former.
Okay, I copied the indication_tester.py into the library and was able to run the indication test successfully. Very cool.
What are your plans for other indication tests? We definitely need to test at least all three of the lifecycle indications in the positive case.
As you said before, it's better to subscribe to a superclass and get all three of the lifecycle indications. So I prepare to change the test case do the setup for each type in a single file. Also, the superclass named "CIM_Indication", right?
How about a test that subscribes to a Xen indication and then creates a KVM guest to make sure that it doesn't get the KVM indication?
You refer to the negative test case to Xen indication?
-- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com [attachment "attjivxz.dat" deleted by Guo Lian Yun/China/IBM] _______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim

GY> As you said before, it's better to subscribe to a superclass and GY> get all three of the lifecycle indications. So I prepare to GY> change the test case do the setup for each type in a single file. Okay. GY> Also, the superclass named "CIM_Indication", right? Yes, I think that's the only common superclass.
How about a test that subscribes to a Xen indication and then creates a KVM guest to make sure that it doesn't get the KVM indication?
GY> You refer to the negative test case to Xen indication?
I'm not sure what you're asking here... -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com
participants (2)
-
Dan Smith
-
Guo Lian Yun