Revision 9cbc1edb htools/Ganeti/HTools/QC.hs

b/htools/Ganeti/HTools/QC.hs
606 606
    ==> isFailure (Node.addSec node inst pdx)
607 607
        where _types = (node::Node.Node, inst::Instance.Instance, pdx::Int)
608 608

  
609
-- | Checks for memory reservation changes
610
prop_Node_rMem node inst =
611
    -- ab = auto_balance, nb = non-auto_balance
612
    -- we use -1 as the primary node of the instance
613
    let inst' = inst { Instance.pNode = (-1), Instance.auto_balance = True}
614
        inst_ab = setInstanceSmallerThanNode node inst'
615
        inst_nb = inst_ab { Instance.auto_balance = False }
616
        -- now we have the two instances, identical except the
617
        -- auto_balance attribute
618
        orig_rmem = Node.rMem node
619
        inst_idx = Instance.idx inst_ab
620
        node_add_ab = Node.addSec node inst_ab (-1)
621
        node_add_nb = Node.addSec node inst_nb (-1)
622
        node_del_ab = liftM (flip Node.removeSec inst_ab) node_add_ab
623
        node_del_nb = liftM (flip Node.removeSec inst_nb) node_add_nb
624
    in case (node_add_ab, node_add_nb, node_del_ab, node_del_nb) of
625
         (Types.OpGood a_ab, Types.OpGood a_nb,
626
          Types.OpGood d_ab, Types.OpGood d_nb) ->
627
             Node.rMem a_ab >  orig_rmem &&
628
             Node.rMem a_ab - orig_rmem == Instance.mem inst_ab &&
629
             Node.rMem a_nb == orig_rmem &&
630
             Node.rMem d_ab == orig_rmem &&
631
             Node.rMem d_nb == orig_rmem &&
632
             -- this is not related to rMem, but as good a place to
633
             -- test as any
634
             inst_idx `elem` Node.sList a_ab &&
635
             not (inst_idx `elem` Node.sList d_ab)
636
         _ -> False
637

  
609 638
newtype SmallRatio = SmallRatio Double deriving Show
610 639
instance Arbitrary SmallRatio where
611 640
    arbitrary = do
......
657 686
    , run prop_Node_addPriFD
658 687
    , run prop_Node_addPriFC
659 688
    , run prop_Node_addSec
689
    , run prop_Node_rMem
660 690
    , run prop_Node_setMdsk
661 691
    , run prop_Node_tagMaps_idempotent
662 692
    , run prop_Node_tagMaps_reject

Also available in: Unified diff