Commit d5dfae0a authored by Iustin Pop's avatar Iustin Pop
Browse files

htools: re-indent QC.hs


Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent fd7a7c73
...@@ -91,8 +91,7 @@ maxCpu = 1024 ...@@ -91,8 +91,7 @@ maxCpu = 1024
defGroup :: Group.Group defGroup :: Group.Group
defGroup = flip Group.setIdx 0 $ defGroup = flip Group.setIdx 0 $
Group.create "default" Utils.defaultGroupID Group.create "default" Utils.defaultGroupID Types.AllocPreferred
Types.AllocPreferred
defGroupList :: Group.List defGroupList :: Group.List
defGroupList = Container.fromList [(Group.idx defGroup, defGroup)] defGroupList = Container.fromList [(Group.idx defGroup, defGroup)]
...@@ -178,7 +177,6 @@ getName = do ...@@ -178,7 +177,6 @@ getName = do
dn <- vector n::Gen [DNSChar] dn <- vector n::Gen [DNSChar]
return (map dnsGetChar dn) return (map dnsGetChar dn)
getFQDN :: Gen String getFQDN :: Gen String
getFQDN = do getFQDN = do
felem <- getName felem <- getName
...@@ -259,8 +257,7 @@ instance Arbitrary OpCodes.OpCode where ...@@ -259,8 +257,7 @@ instance Arbitrary OpCodes.OpCode where
arbitrary arbitrary
"OP_INSTANCE_MIGRATE" -> "OP_INSTANCE_MIGRATE" ->
liftM5 OpCodes.OpInstanceMigrate arbitrary arbitrary liftM5 OpCodes.OpInstanceMigrate arbitrary arbitrary
arbitrary arbitrary arbitrary arbitrary arbitrary
arbitrary
_ -> fail "Wrong opcode") _ -> fail "Wrong opcode")
instance Arbitrary Jobs.OpStatus where instance Arbitrary Jobs.OpStatus where
...@@ -357,7 +354,7 @@ prop_Utils_parseUnit (NonNegative n) = ...@@ -357,7 +354,7 @@ prop_Utils_parseUnit (NonNegative n) =
Utils.parseUnit (show n ++ "m") == Types.Ok n && Utils.parseUnit (show n ++ "m") == Types.Ok n &&
(case Utils.parseUnit (show n ++ "M") of (case Utils.parseUnit (show n ++ "M") of
Types.Ok m -> if n > 0 Types.Ok m -> if n > 0
then m < n -- for positive values, X MB is less than X MiB then m < n -- for positive values, X MB is < than X MiB
else m == 0 -- but for 0, 0 MB == 0 MiB else m == 0 -- but for 0, 0 MB == 0 MiB
Types.Bad _ -> False) && Types.Bad _ -> False) &&
Utils.parseUnit (show n ++ "g") == Types.Ok (n*1024) && Utils.parseUnit (show n ++ "g") == Types.Ok (n*1024) &&
...@@ -505,8 +502,7 @@ prop_Instance_setBoth inst pdx sdx = ...@@ -505,8 +502,7 @@ prop_Instance_setBoth inst pdx sdx =
prop_Instance_shrinkMG inst = prop_Instance_shrinkMG inst =
Instance.mem inst >= 2 * Types.unitMem ==> Instance.mem inst >= 2 * Types.unitMem ==>
case Instance.shrinkByType inst Types.FailMem of case Instance.shrinkByType inst Types.FailMem of
Types.Ok inst' -> Types.Ok inst' -> Instance.mem inst' == Instance.mem inst - Types.unitMem
Instance.mem inst' == Instance.mem inst - Types.unitMem
_ -> False _ -> False
prop_Instance_shrinkMF inst = prop_Instance_shrinkMF inst =
...@@ -588,8 +584,7 @@ prop_Text_Load_Instance name mem dsk vcpus status ...@@ -588,8 +584,7 @@ prop_Text_Load_Instance name mem dsk vcpus status
, vcpus::Int, status::Types.InstanceStatus , vcpus::Int, status::Types.InstanceStatus
, snode::String , snode::String
, autobal::Bool) , autobal::Bool)
in in case inst of
case inst of
Types.Bad msg -> printTestCase ("Failed to load instance: " ++ msg) Types.Bad msg -> printTestCase ("Failed to load instance: " ++ msg)
False False
Types.Ok (_, i) -> printTestCase "Mismatch in some field while\ Types.Ok (_, i) -> printTestCase "Mismatch in some field while\
...@@ -683,10 +678,9 @@ prop_Node_setMcpu node mc = ...@@ -683,10 +678,9 @@ prop_Node_setMcpu node mc =
-- | Check that an instance add with too high memory or disk will be -- | Check that an instance add with too high memory or disk will be
-- rejected. -- rejected.
prop_Node_addPriFM node inst = Instance.mem inst >= Node.fMem node && prop_Node_addPriFM node inst =
not (Node.failN1 node) && Instance.mem inst >= Node.fMem node && not (Node.failN1 node) &&
not (Instance.instanceOffline inst) not (Instance.instanceOffline inst) ==>
==>
case Node.addPri node inst'' of case Node.addPri node inst'' of
Types.OpFail Types.FailMem -> True Types.OpFail Types.FailMem -> True
_ -> False _ -> False
...@@ -694,9 +688,8 @@ prop_Node_addPriFM node inst = Instance.mem inst >= Node.fMem node && ...@@ -694,9 +688,8 @@ prop_Node_addPriFM node inst = Instance.mem inst >= Node.fMem node &&
inst' = setInstanceSmallerThanNode node inst inst' = setInstanceSmallerThanNode node inst
inst'' = inst' { Instance.mem = Instance.mem inst } inst'' = inst' { Instance.mem = Instance.mem inst }
prop_Node_addPriFD node inst = Instance.dsk inst >= Node.fDsk node && prop_Node_addPriFD node inst =
not (Node.failN1 node) Instance.dsk inst >= Node.fDsk node && not (Node.failN1 node) ==>
==>
case Node.addPri node inst'' of case Node.addPri node inst'' of
Types.OpFail Types.FailDisk -> True Types.OpFail Types.FailDisk -> True
_ -> False _ -> False
...@@ -705,8 +698,7 @@ prop_Node_addPriFD node inst = Instance.dsk inst >= Node.fDsk node && ...@@ -705,8 +698,7 @@ prop_Node_addPriFD node inst = Instance.dsk inst >= Node.fDsk node &&
inst'' = inst' { Instance.dsk = Instance.dsk inst } inst'' = inst' { Instance.dsk = Instance.dsk inst }
prop_Node_addPriFC node inst (Positive extra) = prop_Node_addPriFC node inst (Positive extra) =
not (Node.failN1 node) && not (Node.failN1 node) && not (Instance.instanceOffline inst) ==>
not (Instance.instanceOffline inst) ==>
case Node.addPri node inst'' of case Node.addPri node inst'' of
Types.OpFail Types.FailCPU -> True Types.OpFail Types.FailCPU -> True
_ -> False _ -> False
...@@ -720,8 +712,8 @@ prop_Node_addSec node inst pdx = ...@@ -720,8 +712,8 @@ prop_Node_addSec node inst pdx =
((Instance.mem inst >= (Node.fMem node - Node.rMem node) && ((Instance.mem inst >= (Node.fMem node - Node.rMem node) &&
not (Instance.instanceOffline inst)) || not (Instance.instanceOffline inst)) ||
Instance.dsk inst >= Node.fDsk node) && Instance.dsk inst >= Node.fDsk node) &&
not (Node.failN1 node) not (Node.failN1 node) ==>
==> isFailure (Node.addSec node inst pdx) isFailure (Node.addSec node inst pdx)
where _types = (node::Node.Node, inst::Instance.Instance, pdx::Int) where _types = (node::Node.Node, inst::Instance.Instance, pdx::Int)
-- | Check that an offline instance with reasonable disk size can always -- | Check that an offline instance with reasonable disk size can always
...@@ -772,8 +764,7 @@ prop_Node_rMem inst = ...@@ -772,8 +764,7 @@ prop_Node_rMem inst =
-- test as any -- test as any
inst_idx `elem` Node.sList a_ab && inst_idx `elem` Node.sList a_ab &&
not (inst_idx `elem` Node.sList d_ab) not (inst_idx `elem` Node.sList d_ab)
x -> printTestCase ("Failed to add/remove instances: " ++ show x) x -> printTestCase ("Failed to add/remove instances: " ++ show x) False
False
-- | Check mdsk setting. -- | Check mdsk setting.
prop_Node_setMdsk node mx = prop_Node_setMdsk node mx =
...@@ -1028,7 +1019,8 @@ prop_Loader_assignIndices nodes = ...@@ -1028,7 +1019,8 @@ prop_Loader_assignIndices nodes =
(if not (null nodes) (if not (null nodes)
then maximum (IntMap.keys kt) == length nodes - 1 then maximum (IntMap.keys kt) == length nodes - 1
else True) else True)
where (nassoc, kt) = Loader.assignIndices (map (\n -> (Node.name n, n)) nodes) where (nassoc, kt) =
Loader.assignIndices (map (\n -> (Node.name n, n)) nodes)
-- | Checks that the number of primary instances recorded on the nodes -- | Checks that the number of primary instances recorded on the nodes
-- is zero. -- is zero.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment