LGTM, barring newlines and missing articles which I will add. Thanks!

On Thu, Jul 24, 2014 at 2:31 AM, Yuto KAWAMURA(kawamuray) <
[email protected]> wrote:

> This patch adds few unit tests for _IsInstanceAlive method of hv_lxc.
>

... adds a few ... for the ...


> Signed-off-by: Yuto KAWAMURA(kawamuray) <[email protected]>
> ---
>  test/py/ganeti.hypervisor.hv_lxc_unittest.py | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/test/py/ganeti.hypervisor.hv_lxc_unittest.py b/test/py/
> ganeti.hypervisor.hv_lxc_unittest.py
> index 6824308..5891eaf 100755
> --- a/test/py/ganeti.hypervisor.hv_lxc_unittest.py
> +++ b/test/py/ganeti.hypervisor.hv_lxc_unittest.py
> @@ -26,8 +26,10 @@ import unittest
>  from ganeti import constants
>  from ganeti import objects
>  from ganeti import hypervisor
> +from ganeti import utils
>
>  from ganeti.hypervisor import hv_lxc
> +from ganeti.hypervisor.hv_lxc import LXCHypervisor
>
>  import testutils
>
> @@ -49,6 +51,16 @@ class TestConsole(unittest.TestCase):
>      self.assertEqual(cons.host, node.name)
>      self.assertEqual(cons.command[-1], instance.name)
>
> +class TestLXCIsInstanceAlive(unittest.TestCase):
> +  @patch_object(utils, "RunCmd")
> +  def testActive(self, runcmd_mock):
> +    runcmd_mock.return_value = RunResultOk("inst1 inst2 inst3\ninst4
> inst5")
> +    self.assertTrue(LXCHypervisor._IsInstanceAlive("inst4"))
> +

+  @patch_object(utils, "RunCmd")
> +  def testInactive(self, runcmd_mock):
> +    runcmd_mock.return_value = RunResultOk("inst1 inst2foo")
> +    self.assertFalse(LXCHypervisor._IsInstanceAlive("inst2"))
>
>  if __name__ == "__main__":
>    testutils.GanetiTestProgram()
> --
> 1.8.5.5
>

Hrvoje Ribicic
Ganeti Engineering
Google Germany GmbH
Dienerstr. 12, 80331, München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Christine Elizabeth Flores
Steuernummer: 48/725/00206
Umsatzsteueridentifikationsnummer: DE813741370

Reply via email to