[PATCH] [TEST] Add test for verifying disabled RequestStateChange()

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1249668560 25200 # Node ID 9f740b6fe6cfe41317514182f245d1eb9938122c # Parent 12fd8bac01f25251dbfb64dd5e764f533108964b [TEST] Add test for verifying disabled RequestStateChange() Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r 12fd8bac01f2 -r 9f740b6fe6cf suites/libvirt-cim/cimtest/ComputerSystem/34_start_disable.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/suites/libvirt-cim/cimtest/ComputerSystem/34_start_disable.py Fri Aug 07 11:09:20 2009 -0700 @@ -0,0 +1,74 @@ +#!/usr/bin/python +# +# Copyright 2009 IBM Corp. +# +# Authors: +# Kaitlin Rupert <karupert@us.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 +# +# Test Case Info: +# -------------- +# This test case is used to verify the Virtual System State Transition +# information is captured in the RequestedState Property of the VS. +# The test is considered to be successful if RequestedState Property +# has a value of 3 when the VS is moved from active state to a disabled state. +# +# Date: 08-07-2009 + +import sys +from CimTest.Globals import logger +from XenKvmLib.const import do_main +from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC +from XenKvmLib.vxml import get_class + +sup_types = ['Xen', 'XenFV', 'KVM', 'LXC'] + +default_dom = 'cs_test_domain' + +@do_main(sup_types) +def main(): + options = main.options + status = FAIL + server = options.ip + virt = options.virt + + try: + # define the vs + cxml = get_class(virt)(default_dom) + ret = cxml.cim_define(server) + if not ret: + raise Exception("Failed to define the guest: %s" % default_dom) + + status = cxml.cim_start(server) + if status != PASS: + raise Exception("Unable start dom '%s'" % default_dom) + + status = cxml.cim_disable(server) + if status != PASS: + raise Exception("Unable disable dom '%s'" % default_dom) + + except Exception, detail: + logger.error("Exception: %s", detail) + status = FAIL + + cxml.cim_destroy(server) + cxml.undefine(server) + + return status + +if __name__ == "__main__": + sys.exit(main())

Kaitlin Rupert wrote:
# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1249668560 25200 # Node ID 9f740b6fe6cfe41317514182f245d1eb9938122c # Parent 12fd8bac01f25251dbfb64dd5e764f533108964b [TEST] Add test for verifying disabled RequestStateChange()
Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com>
diff -r 12fd8bac01f2 -r 9f740b6fe6cf suites/libvirt-cim/cimtest/ComputerSystem/34_start_disable.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/suites/libvirt-cim/cimtest/ComputerSystem/34_start_disable.py Fri Aug 07 11:09:20 2009 -0700 @@ -0,0 +1,74 @@ +#!/usr/bin/python +# +# Copyright 2009 IBM Corp. +# +# Authors: +# Kaitlin Rupert <karupert@us.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 +# +# Test Case Info: +# -------------- +# This test case is used to verify the Virtual System State Transition +# information is captured in the RequestedState Property of the VS. +# The test is considered to be successful if RequestedState Property +# has a value of 3 when the VS is moved from active state to a disabled state.
The test case does not verify the value if EnabledState is set to 3. Did you miss adding it ?
+# +# Date: 08-07-2009 + +import sys +from CimTest.Globals import logger +from XenKvmLib.const import do_main +from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
XFAIL_RC is not needed
+from XenKvmLib.vxml import get_class + +sup_types = ['Xen', 'XenFV', 'KVM', 'LXC'] + +default_dom = 'cs_test_domain' + +@do_main(sup_types) +def main(): + options = main.options + status = FAIL + server = options.ip + virt = options.virt + + try: + # define the vs + cxml = get_class(virt)(default_dom) + ret = cxml.cim_define(server) + if not ret: + raise Exception("Failed to define the guest: %s" % default_dom) + + status = cxml.cim_start(server) + if status != PASS: + raise Exception("Unable start dom '%s'" % default_dom) + + status = cxml.cim_disable(server) + if status != PASS: + raise Exception("Unable disable dom '%s'" % default_dom) + + except Exception, detail: + logger.error("Exception: %s", detail) + status = FAIL + + cxml.cim_destroy(server)
We do not require cim_destroy if cim_disable is successful.
+ cxml.undefine(server) + + return status + +if __name__ == "__main__": + sys.exit(main())
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
-- Thanks and Regards, Deepti B. Kalakeri IBM Linux Technology Center deeptik@linux.vnet.ibm.com

+# information is captured in the RequestedState Property of the VS. +# The test is considered to be successful if RequestedState Property +# has a value of 3 when the VS is moved from active state to a disabled state.
The test case does not verify the value if EnabledState is set to 3. Did you miss adding it ?
No, it should. I forgot this. Plus, this comment isn't totally accurate, because the behavior will be different depending on the provider version.
+# +# Date: 08-07-2009 + +import sys +from CimTest.Globals import logger +from XenKvmLib.const import do_main +from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
XFAIL_RC is not needed
Good call.
+ + cxml.cim_destroy(server)
We do not require cim_destroy if cim_disable is successful.
With the older versions of the providers, we do. Because with the other versions. disable is mapped to a reboot.
+ cxml.undefine(server) +
-- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
participants (2)
-
Deepti B Kalakeri
-
Kaitlin Rupert