Revision 746b7aa6 htools/Ganeti/HTools/QC.hs

b/htools/Ganeti/HTools/QC.hs
881 881
          inst' = setInstanceSmallerThanNode node inst
882 882
          inst'' = inst' { Instance.dsk = Instance.dsk inst }
883 883

  
884
prop_Node_addPriFC node inst (Positive extra) =
885
  not (Node.failN1 node) && not (Instance.instanceOffline inst) ==>
886
      case Node.addPri node inst'' of
887
        Types.OpFail Types.FailCPU -> True
888
        _ -> False
889
    where _types = (node::Node.Node, inst::Instance.Instance)
890
          inst' = setInstanceSmallerThanNode node inst
891
          inst'' = inst' { Instance.vcpus = Node.availCpu node + extra }
884
prop_Node_addPriFC (Positive extra) =
885
  forAll genOnlineNode $ \node ->
886
  forAll (arbitrary `suchThat` Instance.instanceNotOffline) $ \inst ->
887
  let inst' = setInstanceSmallerThanNode node inst
888
      inst'' = inst' { Instance.vcpus = Node.availCpu node + extra }
889
  in case Node.addPri node inst'' of
890
       Types.OpFail Types.FailCPU -> property True
891
       v -> failTest $ "Expected OpFail FailCPU, but got " ++ show v
892 892

  
893 893
-- | Check that an instance add with too high memory or disk will be
894 894
-- rejected.

Also available in: Unified diff