Perhaps I'd suggest to add a comment to mocked TryUpdateLocks so that UpdateLocksWaiting relies on it always succeeding (if somebody touches that part in the future). Other than that LGTM, no need to resend.
+1 for ' so called "unit tests"' On Wed, Jun 4, 2014 at 10:20 AM, 'Klaus Aehlig' via ganeti-devel < [email protected]> wrote: > ...and implement so in the most trivial way, always suceeding > immediately. The point is, these mocks are not used to test > the mcpu that uses the WConfD client but, instead, indirectly > in our so called "unit tests" for the logical units that call > the real mpcu. > > Signed-off-by: Klaus Aehlig <[email protected]> > --- > test/py/cmdlib/testsupport/wconfd_mock.py | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/test/py/cmdlib/testsupport/wconfd_mock.py > b/test/py/cmdlib/testsupport/wconfd_mock.py > index 6823083..b19b336 100644 > --- a/test/py/cmdlib/testsupport/wconfd_mock.py > +++ b/test/py/cmdlib/testsupport/wconfd_mock.py > @@ -38,6 +38,14 @@ class MockClient(object): > self.wconfdmock.mylocks[lockrq[0]] = lockrq[1] > return [] > > + def UpdateLocksWaiting(self, cid, _prio, req): > + # as our mock TryUpdateLocks always suceeds, we can > + # just use it > + return self.TryUpdateLocks(cid, req) > + > + def HasPendingRequest(self, _cid): > + return False > + > def ListLocks(self, *_): > result = [] > for lock in self.wconfdmock.mylocks: > -- > 1.9.1.423.g4596e3a > >
