On Fri, Sep 27, 2013 at 3:36 PM, Raffa Santi <[email protected]> wrote:
> > Signed-off-by: Raffa Santi <[email protected]> > --- > test/py/cmdlib/cluster_unittest.py | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/test/py/cmdlib/cluster_unittest.py > b/test/py/cmdlib/cluster_unittest.py > index e8438a3..8866a25 100644 > --- a/test/py/cmdlib/cluster_unittest.py > +++ b/test/py/cmdlib/cluster_unittest.py > @@ -446,6 +446,23 @@ class TestLUClusterSetParams(CmdlibTestCase): > self.ExecOpCode(op) > self.assertEqual(diskparams, self.cluster.diskparams) > > + def testValidDiskparamsAccess(self): > + attr_gen = lambda value: {constants.DT_RBD: {constants.LDP_ACCESS: > value}} > I actually would prefer an inline dict where required, just as the other tests do. > + for value in constants.DISK_VALID_ACCESS_PROTOCOLS: > + self.ResetMocks() > + op = opcodes.OpClusterSetParams(diskparams=attr_gen(value)) > + self.ExecOpCode(op) > + have = attr_gen(value)[constants.DT_RBD][constants.LDP_ACCESS] > Isn't that just value? > + got = > self.cluster.diskparams[constants.DT_RBD][constants.LDP_ACCESS] > + self.assertEqual(have, got) > + > + def testInvalidDiskparamsAccess(self): > + attr_gen = lambda value: {constants.DT_RBD: {constants.LDP_ACCESS: > value}} > + for value in ["default", "pinky_bunny"]: > + self.ResetMocks() > + op = opcodes.OpClusterSetParams(diskparams=attr_gen(value)) > + self.ExecOpCodeExpectOpPrereqError(op, "Invalid value of > 'rbd:access'") > + > def testUnsetDrbdHelperWithDrbdDisks(self): > self.cfg.AddNewInstance(disks=[ > self.cfg.CreateDisk(dev_type=constants.DT_DRBD8, > create_nodes=True)]) > -- > 1.7.10.4 > > -- 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
