Revision 45c4d54d
b/htools/Ganeti/HTools/QC.hs | ||
---|---|---|
976 | 976 |
isFailure (Node.addSec node inst pdx) |
977 | 977 |
where _types = (node::Node.Node, inst::Instance.Instance, pdx::Int) |
978 | 978 |
|
979 |
-- | Check that an offline instance with reasonable disk size can always |
|
980 |
-- be added. |
|
981 |
prop_Node_addPriOffline = |
|
982 |
forAll (arbitrary `suchThat` ((> 0) . Node.fMem)) $ \node -> |
|
983 |
forAll (arbitrary `suchThat` |
|
984 |
(\ x -> (Instance.dsk x < Node.fDsk node) && |
|
985 |
Instance.instanceOffline x)) $ \inst -> |
|
986 |
case Node.addPri node inst of |
|
987 |
Types.OpGood _ -> True |
|
988 |
_ -> False |
|
989 |
|
|
990 |
prop_Node_addSecOffline pdx = |
|
979 |
-- | Check that an offline instance with reasonable disk size but |
|
980 |
-- extra mem/cpu can always be added. |
|
981 |
prop_Node_addOffline (NonNegative extra_mem) (NonNegative extra_cpu) pdx = |
|
991 | 982 |
forAll genOnlineNode $ \node -> |
992 |
forAll (arbitrary `suchThat` |
|
993 |
(\ inst -> Instance.dsk inst < Node.availDisk node)) $ \inst -> |
|
994 |
case Node.addSec node (inst { Instance.runSt = Types.AdminOffline }) pdx of |
|
995 |
Types.OpGood _ -> True |
|
996 |
_ -> False |
|
983 |
forAll (genInstanceSmallerThanNode node) $ \inst -> |
|
984 |
let inst' = inst { Instance.runSt = Types.AdminOffline |
|
985 |
, Instance.mem = Node.availMem node + extra_mem |
|
986 |
, Instance.vcpus = Node.availCpu node + extra_cpu } |
|
987 |
in case (Node.addPri node inst', Node.addSec node inst' pdx) of |
|
988 |
(Types.OpGood _, Types.OpGood _) -> property True |
|
989 |
v -> failTest $ "Expected OpGood/OpGood, but got: " ++ show v |
|
997 | 990 |
|
998 | 991 |
-- | Checks for memory reservation changes. |
999 | 992 |
prop_Node_rMem inst = |
... | ... | |
1071 | 1064 |
, 'prop_Node_addPriFD |
1072 | 1065 |
, 'prop_Node_addPriFC |
1073 | 1066 |
, 'prop_Node_addSec |
1074 |
, 'prop_Node_addPriOffline |
|
1075 |
, 'prop_Node_addSecOffline |
|
1067 |
, 'prop_Node_addOffline |
|
1076 | 1068 |
, 'prop_Node_rMem |
1077 | 1069 |
, 'prop_Node_setMdsk |
1078 | 1070 |
, 'prop_Node_tagMaps_idempotent |
Also available in: Unified diff