This tests “unknown” values of “constants.XEN_CMD”.
---
 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 e4a21d1..67dc785 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()
-- 
1.8.1

Reply via email to