hv_xen: Test reading non-existent config file
authorMichael Hanselmann <hansmi@google.com>
Thu, 24 Jan 2013 14:11:09 +0000 (15:11 +0100)
committerMichael Hanselmann <hansmi@google.com>
Fri, 25 Jan 2013 10:58:51 +0000 (11:58 +0100)
Check whether doing so raises an exception.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

test/py/ganeti.hypervisor.hv_xen_unittest.py

index 134182d..18b94a1 100755 (executable)
@@ -366,6 +366,16 @@ class _TestXenHypervisor(object):
                            "", "This command failed", None,
                            NotImplemented, NotImplemented)
 
+  def testReadingNonExistentConfigFile(self):
+    hv = self._GetHv()
+
+    try:
+      hv._ReadConfigFile("inst15780.example.com")
+    except errors.HypervisorError, err:
+      self.assertTrue(str(err).startswith("Failed to load Xen config file:"))
+    else:
+      self.fail("Exception was not raised")
+
   def testRemovingAutoConfigFile(self):
     name = "inst8206.example.com"
     cfgfile = utils.PathJoin(self.tmpdir, name)