On Tue, Feb 18, 2014 at 3:28 PM, Klaus Aehlig <[email protected]> wrote:
> There are no restrictions on releasing a lock; so this operation > has to succeed unconditionally. Verify this. > > Signed-off-by: Klaus Aehlig <[email protected]> > --- > test/hs/Test/Ganeti/Locking/Allocation.hs | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/test/hs/Test/Ganeti/Locking/Allocation.hs > b/test/hs/Test/Ganeti/Locking/Allocation.hs > index dccceab..4ebcc08 100644 > --- a/test/hs/Test/Ganeti/Locking/Allocation.hs > +++ b/test/hs/Test/Ganeti/Locking/Allocation.hs > @@ -135,8 +135,21 @@ prop_LockupdateAtomic = > ("Update failed, but state changed to " ++ show state') > (state == state') > > +-- | Verify that releasing a lock always succeeds. > +prop_LockReleaseSucceeds :: Property > +prop_LockReleaseSucceeds = > + forAll (arbitrary :: Gen (LockAllocation TestLock TestOwner)) $ \state > -> > + forAll (arbitrary :: Gen TestOwner) $ \a -> > + forAll (arbitrary :: Gen TestLock) $ \lock -> > + let (_, result) = updateLocks a [requestRelease lock] state > + in printTestCase > + ("Releasing a lock has to suceed uncondiationally, but got " > s/suceed/succeed/ + ++ show result) > + (isOk result) > + > testSuite "Locking/Allocation" > [ 'prop_LocksDisjoint > , 'prop_LocksStable > , 'prop_LockupdateAtomic > + , 'prop_LockReleaseSucceeds > ] > -- > 1.9.0.rc1.175.g0b1dcb5 > > Otherwise LGTM (no need to resend).
