hv_xen: Test verifying hypervisor
authorMichael Hanselmann <hansmi@google.com>
Thu, 24 Jan 2013 14:10:37 +0000 (15:10 +0100)
committerMichael Hanselmann <hansmi@google.com>
Fri, 25 Jan 2013 10:58:49 +0000 (11:58 +0100)
Test success and failure.

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

test/py/ganeti.hypervisor.hv_xen_unittest.py

index 61c7085..134182d 100755 (executable)
@@ -383,6 +383,16 @@ class _TestXenHypervisor(object):
     self.assertFalse(os.path.exists(autocfgfile))
     self.assertEqual(utils.ReadFile(cfgfile), "content")
 
+  def testVerify(self):
+    output = testutils.ReadTestData("xen-xm-info-4.0.1.txt")
+    hv = self._GetHv(run_cmd=compat.partial(self._SuccessCommand,
+                                            output))
+    self.assertTrue(hv.Verify() is None)
+
+  def testVerifyFailing(self):
+    hv = self._GetHv(run_cmd=self._FailingCommand)
+    self.assertTrue("failed:" in hv.Verify())
+
 
 def _MakeTestClass(cls, cmd):
   """Makes a class for testing.