Revision 9f9c4543 test/hs/Test/Ganeti/Locking/Allocation.hs
b/test/hs/Test/Ganeti/Locking/Allocation.hs | ||
---|---|---|
94 | 94 |
|
95 | 95 |
data UpdateRequest b a = UpdateRequest b [LockRequest a] |
96 | 96 |
| IntersectRequest b [a] |
97 |
| OpportunisticUnion b [(a, OwnerState)] |
|
97 | 98 |
| FreeLockRequest b |
98 | 99 |
deriving Show |
99 | 100 |
|
... | ... | |
102 | 103 |
frequency [ (4, UpdateRequest <$> arbitrary <*> (choose (1, 4) >>= vector)) |
103 | 104 |
, (2, IntersectRequest <$> arbitrary |
104 | 105 |
<*> (choose (1, 4) >>= vector)) |
106 |
, (2, OpportunisticUnion <$> arbitrary |
|
107 |
<*> (choose (1, 4) >>= vector)) |
|
105 | 108 |
, (1, FreeLockRequest <$> arbitrary) |
106 | 109 |
] |
107 | 110 |
|
... | ... | |
112 | 115 |
fst $ updateLocks owner updates state |
113 | 116 |
asAllocTrans state (IntersectRequest owner locks) = |
114 | 117 |
intersectLocks owner locks state |
118 |
asAllocTrans state (OpportunisticUnion owner locks) = |
|
119 |
fst $ opportunisticLockUnion owner locks state |
|
115 | 120 |
asAllocTrans state (FreeLockRequest owner) = freeLocks state owner |
116 | 121 |
|
117 | 122 |
-- | Fold a sequence of requests to transform a lock allocation onto the empty |
Also available in: Unified diff