Revision ac1c0a07
b/htools/Ganeti/HTools/QC.hs | ||
---|---|---|
232 | 232 |
newelem <- arbitrary `suchThat` (`notElem` lst) |
233 | 233 |
return (newelem:lst)) [] [1..cnt] |
234 | 234 |
|
235 |
-- | Checks if an instance is mirrored. |
|
236 |
isMirrored :: Instance.Instance -> Bool |
|
237 |
isMirrored = |
|
238 |
(/= Types.MirrorNone) . Types.templateMirrorType . Instance.diskTemplate |
|
239 |
|
|
240 |
-- | Returns the possible change node types for a disk template. |
|
241 |
evacModeOptions :: Types.MirrorType -> [Types.EvacMode] |
|
242 |
evacModeOptions Types.MirrorNone = [] |
|
243 |
evacModeOptions Types.MirrorInternal = [minBound..maxBound] -- DRBD can do all |
|
244 |
evacModeOptions Types.MirrorExternal = [Types.ChangePrimary, Types.ChangeAll] |
|
245 |
|
|
235 | 246 |
-- * Arbitrary instances |
236 | 247 |
|
237 | 248 |
-- | Defines a DNS name. |
... | ... | |
1260 | 1271 |
prop_ClusterAllocEvacuate = |
1261 | 1272 |
forAll (choose (4, 8)) $ \count -> |
1262 | 1273 |
forAll (genOnlineNode `suchThat` (isNodeBig 4)) $ \node -> |
1263 |
forAll (genInstanceSmallerThanNode node) $ \inst -> |
|
1274 |
forAll (genInstanceSmallerThanNode node `suchThat` isMirrored) $ \inst ->
|
|
1264 | 1275 |
case genClusterAlloc count node inst of |
1265 | 1276 |
Types.Bad msg -> failTest msg |
1266 | 1277 |
Types.Ok (nl, il, inst') -> |
1267 | 1278 |
conjoin $ map (\mode -> check_EvacMode defGroup inst' $ |
1268 | 1279 |
Cluster.tryNodeEvac defGroupList nl il mode |
1269 |
[Instance.idx inst']) [minBound..maxBound] |
|
1280 |
[Instance.idx inst']) . |
|
1281 |
evacModeOptions . Types.templateMirrorType . |
|
1282 |
Instance.diskTemplate $ inst' |
|
1270 | 1283 |
|
1271 | 1284 |
-- | Checks that on a 4-8 node cluster with two node groups, once we |
1272 | 1285 |
-- allocate an instance on the first node group, we can also change |
... | ... | |
1274 | 1287 |
prop_ClusterAllocChangeGroup = |
1275 | 1288 |
forAll (choose (4, 8)) $ \count -> |
1276 | 1289 |
forAll (genOnlineNode `suchThat` (isNodeBig 4)) $ \node -> |
1277 |
forAll (genInstanceSmallerThanNode node) $ \inst -> |
|
1290 |
forAll (genInstanceSmallerThanNode node `suchThat` isMirrored) $ \inst ->
|
|
1278 | 1291 |
case genClusterAlloc count node inst of |
1279 | 1292 |
Types.Bad msg -> failTest msg |
1280 | 1293 |
Types.Ok (nl, il, inst') -> |
Also available in: Unified diff