Revision c6e8fb9c htools/Ganeti/HTools/QC.hs
b/htools/Ganeti/HTools/QC.hs | ||
---|---|---|
848 | 848 |
-- small cluster sizes. |
849 | 849 |
prop_Text_CreateSerialise = |
850 | 850 |
forAll genTags $ \ctags -> |
851 |
forAll (choose (1, 2)) $ \reqnodes -> |
|
852 | 851 |
forAll (choose (1, 20)) $ \maxiter -> |
853 | 852 |
forAll (choose (2, 10)) $ \count -> |
854 | 853 |
forAll genOnlineNode $ \node -> |
855 | 854 |
forAll (genInstanceSmallerThanNode node) $ \inst -> |
856 | 855 |
let nl = makeSmallCluster node count |
856 |
reqnodes = Instance.requiredNodes $ Instance.diskTemplate inst |
|
857 | 857 |
in case Cluster.genAllocNodes defGroupList nl reqnodes True >>= \allocn -> |
858 | 858 |
Cluster.iterateAlloc nl Container.empty (Just maxiter) inst allocn [] [] |
859 | 859 |
of |
... | ... | |
1161 | 1161 |
forAll (choose (5, 20)) $ \count -> |
1162 | 1162 |
forAll genOnlineNode $ \node -> |
1163 | 1163 |
let (nl, il, inst') = makeSmallEmptyCluster node count inst |
1164 |
in case Cluster.genAllocNodes defGroupList nl 2 True >>= |
|
1164 |
reqnodes = Instance.requiredNodes $ Instance.diskTemplate inst |
|
1165 |
in case Cluster.genAllocNodes defGroupList nl reqnodes True >>= |
|
1165 | 1166 |
Cluster.tryAlloc nl il inst' of |
1166 | 1167 |
Types.Bad _ -> False |
1167 | 1168 |
Types.Ok as -> |
... | ... | |
1178 | 1179 |
-- computed allocation statistics are correct. |
1179 | 1180 |
prop_ClusterCanTieredAlloc inst = |
1180 | 1181 |
forAll (choose (2, 5)) $ \count -> |
1181 |
forAll (choose (1, 2)) $ \rqnodes -> |
|
1182 | 1182 |
forAll (genOnlineNode `suchThat` (isNodeBig 4)) $ \node -> |
1183 | 1183 |
let nl = makeSmallCluster node count |
1184 | 1184 |
il = Container.empty |
1185 |
rqnodes = Instance.requiredNodes $ Instance.diskTemplate inst |
|
1185 | 1186 |
allocnodes = Cluster.genAllocNodes defGroupList nl rqnodes True |
1186 | 1187 |
in case allocnodes >>= \allocnodes' -> |
1187 | 1188 |
Cluster.tieredAlloc nl il (Just 1) inst allocnodes' [] [] of |
... | ... | |
1208 | 1209 |
-- and allocate an instance on it. |
1209 | 1210 |
genClusterAlloc count node inst = |
1210 | 1211 |
let nl = makeSmallCluster node count |
1211 |
in case Cluster.genAllocNodes defGroupList nl 2 True >>= |
|
1212 |
reqnodes = Instance.requiredNodes $ Instance.diskTemplate inst |
|
1213 |
in case Cluster.genAllocNodes defGroupList nl reqnodes True >>= |
|
1212 | 1214 |
Cluster.tryAlloc nl Container.empty inst of |
1213 | 1215 |
Types.Bad _ -> Types.Bad "Can't allocate" |
1214 | 1216 |
Types.Ok as -> |
Also available in: Unified diff