Revision 987fcfb7 test/hs/Test/Ganeti/Locking/Allocation.hs

b/test/hs/Test/Ganeti/Locking/Allocation.hs
34 34

  
35 35
import Test.QuickCheck
36 36

  
37
import Test.Ganeti.TestCommon
37 38
import Test.Ganeti.TestHelper
38 39

  
39 40
import Ganeti.Locking.Allocation
......
101 102
     (show a ++ "'s exclusive lock" ++ " is not respected by " ++ show b)
102 103
     (S.null $ S.intersection aExclusive bAll)
103 104

  
105
-- | Verify that locks can only be modified by updates of the owner.
106
prop_LocksStable :: Property
107
prop_LocksStable =
108
  forAll (arbitrary :: Gen (LockAllocation TestLock TestOwner)) $ \state ->
109
  forAll (arbitrary :: Gen TestOwner) $ \a ->
110
  forAll (arbitrary `suchThat` (/= a)) $ \b ->
111
  forAll (arbitrary :: Gen [LockRequest TestLock]) $ \request ->
112
  let (state', _) = updateLocks b request state
113
  in (listLocks a state ==? listLocks a state')
114

  
104 115
testSuite "Locking/Allocation"
105 116
 [ 'prop_LocksDisjoint
117
 , 'prop_LocksStable
106 118
 ]

Also available in: Unified diff