LGTM
On Thu, Mar 6, 2014 at 2:37 PM, Klaus Aehlig <[email protected]> wrote: > Add a test verifying that the list of lock owners is not > too big in the sense that every subject contained in that > list owns at least one lock. > > Signed-off-by: Klaus Aehlig <[email protected]> > --- > test/hs/Test/Ganeti/Locking/Allocation.hs | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/test/hs/Test/Ganeti/Locking/Allocation.hs > b/test/hs/Test/Ganeti/Locking/Allocation.hs > index efab51e..98e5859 100644 > --- a/test/hs/Test/Ganeti/Locking/Allocation.hs > +++ b/test/hs/Test/Ganeti/Locking/Allocation.hs > @@ -321,6 +321,15 @@ prop_OwnerComplete = > forAll (arbitrary :: Gen (LockAllocation TestLock TestOwner)) $ \state > -> > foldl freeLocks state (lockOwners state) ==? emptyAllocation > > +-- | Verify that each owner actually owns a lock. > +prop_OwnerSound :: Property > +prop_OwnerSound = > + forAll ((arbitrary :: Gen (LockAllocation TestLock TestOwner)) > + `suchThat` (not . null . lockOwners)) $ \state -> > + printTestCase "All subjects listed as owners must own at least one lock" > + . flip all (lockOwners state) $ \owner -> > + not . M.null $ listLocks owner state > + > testSuite "Locking/Allocation" > [ 'prop_LocksDisjoint > , 'prop_LockImplicationX > @@ -334,4 +343,5 @@ testSuite "Locking/Allocation" > , 'prop_OpportunisticAnswer > , 'prop_ReadShow > , 'prop_OwnerComplete > + , 'prop_OwnerSound > ] > -- > 1.9.0.279.gdc9e3eb > >
