Revision a9c3ba29
b/test/hs/Test/Ganeti/Locking/Allocation.hs | ||
---|---|---|
127 | 127 |
let (state', result) = updateLocks a request state |
128 | 128 |
in if result == Ok S.empty |
129 | 129 |
then printTestCase |
130 |
("Update suceeded, but in final state " ++ show state' |
|
130 |
("Update succeeded, but in final state " ++ show state'
|
|
131 | 131 |
++ "not all locks are as requested") |
132 | 132 |
$ let owned = listLocks a state' |
133 | 133 |
in all (requestSucceeded owned) request |
... | ... | |
135 | 135 |
("Update failed, but state changed to " ++ show state') |
136 | 136 |
(state == state') |
137 | 137 |
|
138 |
-- | Verify that releasing a lock always succeeds. |
|
139 |
prop_LockReleaseSucceeds :: Property |
|
140 |
prop_LockReleaseSucceeds = |
|
141 |
forAll (arbitrary :: Gen (LockAllocation TestLock TestOwner)) $ \state -> |
|
142 |
forAll (arbitrary :: Gen TestOwner) $ \a -> |
|
143 |
forAll (arbitrary :: Gen TestLock) $ \lock -> |
|
144 |
let (_, result) = updateLocks a [requestRelease lock] state |
|
145 |
in printTestCase |
|
146 |
("Releasing a lock has to suceed uncondiationally, but got " |
|
147 |
++ show result) |
|
148 |
(isOk result) |
|
149 |
|
|
138 | 150 |
testSuite "Locking/Allocation" |
139 | 151 |
[ 'prop_LocksDisjoint |
140 | 152 |
, 'prop_LocksStable |
141 | 153 |
, 'prop_LockupdateAtomic |
154 |
, 'prop_LockReleaseSucceeds |
|
142 | 155 |
] |
Also available in: Unified diff