diff --git a/test/py/ganeti.hypervisor.hv_xen_unittest.py b/test/py/ganeti.hypervisor.hv_xen_unittest.py
index e4a21d1b747fa294075425666a2b40c334ebb315..67dc7859be884c7615d233ddac28cc8122248629 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()