From 1dee20414ac77a07fcaa662e1661382a4545eb79 Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Thu, 24 Jan 2013 15:01:55 +0100 Subject: [PATCH] hv_xen: Test using unknown Xen command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This tests βunknownβ values of βconstants.XEN_CMDβ. Signed-off-by: Michael Hanselmann <hansmi@google.com> Reviewed-by: Helga Velroyen <helgav@google.com> --- test/py/ganeti.hypervisor.hv_xen_unittest.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/py/ganeti.hypervisor.hv_xen_unittest.py b/test/py/ganeti.hypervisor.hv_xen_unittest.py index e4a21d1b7..67dc7859b 100755 --- a/test/py/ganeti.hypervisor.hv_xen_unittest.py +++ b/test/py/ganeti.hypervisor.hv_xen_unittest.py @@ -288,5 +288,15 @@ class TestGetConfigFileDiskData(unittest.TestCase): self.assertRaises(KeyError, hv_xen._GetConfigFileDiskData, disks, "sd") +class TestXenHypervisorUnknownCommand(unittest.TestCase): + def test(self): + cmd = "#unknown command#" + self.assertFalse(cmd in constants.KNOWN_XEN_COMMANDS) + hv = hv_xen.XenHypervisor(_cfgdir=NotImplemented, + _run_cmd_fn=NotImplemented, + _cmd=cmd) + self.assertRaises(errors.ProgrammerError, hv._RunXen, []) + + if __name__ == "__main__": testutils.GanetiTestProgram() -- GitLab