On 12/01, Federico Pareschi wrote:
> On 1 December 2016 at 10:34, Yiannis Tsiouris <[email protected]> wrote:
>
> > From: Nikos Skalkotos <[email protected]>
> >
> > Add LUInstanceSetParams tests for removing individual public & private
> > parameters, as well as, for clearing out public & private parameters.
> >
> > Signed-off-by: Nikos Skalkotos <[email protected]>
> > Signed-off-by: Yiannis Tsiouris <[email protected]>
> > ---
> > test/py/cmdlib/instance_unittest.py | 36 ++++++++++++++++++++++++++++++
> > ++++++
> > 1 file changed, 36 insertions(+)
> >
> > diff --git a/test/py/cmdlib/instance_unittest.py
> > b/test/py/cmdlib/instance_unittest.py
> > index d725015..3701805 100644
> > --- a/test/py/cmdlib/instance_unittest.py
> > +++ b/test/py/cmdlib/instance_unittest.py
> > @@ -2237,6 +2237,42 @@ class TestLUInstanceSetParams(CmdlibTestCase):
> > })
> > self.ExecOpCode(op)
> >
> > + def testRemoveOsParam(self):
> > + os_param = self.os.supported_parameters[0]
> > + self.inst.osparams[os_param] = "test_param_val"
> > + op = self.CopyOpCode(self.op, remove_osparams=[
> > + self.os.supported_parameters[0]])
> > + self.ExecOpCode(op)
> > + self.assertFalse(os_param in self.inst.osparams)
> > +
> > + def testClearOsParams(self):
> > + os = self.cfg.CreateOs(supported_parameters=["param1", "param2"])
> > + inst = self.cfg.AddNewInstance(osparams={
> > + os.supported_parameters[0]: "val0",
> > + os.supported_parameters[1]: "val1"})
> > +
> > + op = self.CopyOpCode(self.op, clear_osparams=True, instance_name=
> > inst.name)
> > + self.ExecOpCode(op)
> > + self.assertEqual(len(inst.osparams), 0)
> > +
> > + def testRemovePrivateOsParam(self):
> > + os_param = self.os.supported_parameters[0]
> > + self.inst.osparams_private[os_param] = "test_param_val"
> > + op = self.CopyOpCode(self.op, remove_osparams_private=[
> > + self.os.supported_parameters[0]])
>
>
> Maybe move "remove_osparams_private=..." to a newline under self.op
> so it indents better and you don't need to wrap its value instead.
OK. Will resend this as well.
> + self.ExecOpCode(op)
> > + self.assertFalse(os_param in self.inst.osparams_private)
> > +
> > + def testClearPrivateOsParams(self):
> > + os = self.cfg.CreateOs(supported_parameters=["param1", "param2"])
> > + inst = self.cfg.AddNewInstance(osparams={
> > + os.supported_parameters[0]: "val0",
> > + os.supported_parameters[1]: "val1"})
> > +
> > + op = self.CopyOpCode(self.op, clear_osparams=True, instance_name=
> > inst.name)
> > + self.ExecOpCode(op)
> > + self.assertEqual(len(inst.osparams), 0)
While at it, we noticed that the above test should use 'osparams_private' in
AddNewInstance so will fix this as well!
Thanks!
> > def testIncreaseMemoryTooMuch(self):
> > op = self.CopyOpCode(self.running_op,
> > beparams={
> > --
> > 2.10.2
> >
> >