LGTM, thanks

On Wed, Jul 30, 2014 at 6:36 PM, Yuto KAWAMURA(kawamuray) <
[email protected]> wrote:

> This patch adds a few unit tests for the _IsInstanceAlive method of
> hv_lxc.
>
> Signed-off-by: Yuto KAWAMURA(kawamuray) <[email protected]>
> ---
>  test/py/ganeti.hypervisor.hv_lxc_unittest.py | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/test/py/ganeti.hypervisor.hv_lxc_unittest.py b/test/py/
> ganeti.hypervisor.hv_lxc_unittest.py
> index 817cdb2..d005fe1 100755
> --- a/test/py/ganeti.hypervisor.hv_lxc_unittest.py
> +++ b/test/py/ganeti.hypervisor.hv_lxc_unittest.py
> @@ -26,10 +26,13 @@ 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
> +from testutils import patch_object
>
>
>  def RunResultOk(stdout):
> @@ -51,5 +54,17 @@ class TestConsole(unittest.TestCase):
>      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