On Wed, Sep 11, 2013 at 5:01 PM, Klaus Aehlig <[email protected]> wrote:

> On Wed, Sep 11, 2013 at 04:42:57PM +0200, Thomas Thrainer wrote:
> > This patch adds unit tests for LUInstanceSetParams. It does not provide
> > 100% coverage, but covers a significant portion.
> >
> > Signed-off-by: Thomas Thrainer <[email protected]>
> > ---
> >  test/py/cmdlib/instance_unittest.py         | 488
> ++++++++++++++++++++++++++++
> >  test/py/cmdlib/testsupport/config_mock.py   |  11 +-
> >  test/py/cmdlib/testsupport/netutils_mock.py |   3 +
> >  3 files changed, 500 insertions(+), 2 deletions(-)
>
> Thanks for changing the tests.
>
> > +  def testInvalidRuntimeMemory(self):
> > +    op = self.CopyOpCode(self.running_op,
> > +                         runtime_mem=8192)
> > +    self.ExecOpCodeExpectOpPrereqError(
> > +      op, "Instance .* must have memory between .* and .* of memory")
>
> Here, the role of the magic constant 8192 is hard to understand;
> can be somehow make it easier to understand how the test is working
> (at least by adding some explanatory comment)?
>
>
Sorry, missed that one. Interdiff:

diff --git a/test/py/cmdlib/instance_unittest.py
b/test/py/cmdlib/instance_unittest.py
index 3a85085..55cdd97 100644
--- a/test/py/cmdlib/instance_unittest.py
+++ b/test/py/cmdlib/instance_unittest.py
@@ -1919,15 +1919,15 @@ class TestLUInstanceSetParams(CmdlibTestCase):

   def testInvalidRuntimeMemory(self):
     op = self.CopyOpCode(self.running_op,
-                         runtime_mem=8192)
+                         runtime_mem=self.mocked_master_memory_free * 2)
     self.ExecOpCodeExpectOpPrereqError(
       op, "Instance .* must have memory between .* and .* of memory")

   def testIncreaseRuntimeMemory(self):
     op = self.CopyOpCode(self.running_op,
-                         runtime_mem=2048,
+                         runtime_mem=self.mocked_master_memory_free,
                          beparams={
-                           constants.BE_MAXMEM: 2048
+                           constants.BE_MAXMEM:
self.mocked_master_memory_free
                          })
     self.ExecOpCode(op)


> --
> Klaus Aehlig
> Google Germany GmbH, Dienerstr. 12, 80331 Muenchen
> Registergericht und -nummer: Hamburg, HRB 86891
> Sitz der Gesellschaft: Hamburg
> Geschaeftsfuehrer: Graham Law, Christine Elizabeth Flores
>



-- 
Thomas Thrainer | Software Engineer | [email protected] |

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

Reply via email to