Revision cf7f8e51
b/test/hs/Test/Ganeti/Locking/Locks.hs | ||
---|---|---|
37 | 37 |
import Test.Ganeti.TestCommon |
38 | 38 |
|
39 | 39 |
import Ganeti.Locking.Locks |
40 |
import Ganeti.Locking.Types |
|
40 | 41 |
|
41 | 42 |
instance Arbitrary GanetiLocks where |
42 | 43 |
arbitrary = oneof [ return BGL |
... | ... | |
58 | 59 |
prop_ReadShow = forAll (arbitrary :: Gen GanetiLocks) $ \a -> |
59 | 60 |
readJSON (showJSON a) ==? Ok a |
60 | 61 |
|
62 |
-- | Verify the implied locks are earlier in the lock order. |
|
63 |
prop_ImpliedOrder :: Property |
|
64 |
prop_ImpliedOrder = |
|
65 |
forAll ((arbitrary :: Gen GanetiLocks) |
|
66 |
`suchThat` (not . null . lockImplications)) $ \b -> |
|
67 |
printTestCase "Implied locks must be earlier in the lock order" |
|
68 |
. flip all (lockImplications b) $ \a -> |
|
69 |
a < b |
|
61 | 70 |
|
62 | 71 |
testSuite "Locking/Locks" |
63 | 72 |
[ 'prop_ReadShow |
73 |
, 'prop_ImpliedOrder |
|
64 | 74 |
] |
Also available in: Unified diff