Commit dd77da99 authored by Helga Velroyen's avatar Helga Velroyen Committed by Iustin Pop
Browse files

A few unittests improvements



Small simplifications of other unit tests using the (==?)
operator when possible, and typo fixes.
Signed-off-by: default avatarHelga Velroyen <helgav@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 651c1c3e
......@@ -53,7 +53,7 @@ import qualified Ganeti.HTools.Types as Types
-- * Arbitrary instances
-- | Generas an arbitrary node based on sizing information.
-- | Generates an arbitrary node based on sizing information.
genNode :: Maybe Int -- ^ Minimum node size in terms of units
-> Maybe Int -- ^ Maximum node size (when Nothing, bounded
-- just by the max... constants)
......@@ -126,9 +126,7 @@ prop_addPriFM :: Node.Node -> Instance.Instance -> Property
prop_addPriFM node inst =
Instance.mem inst >= Node.fMem node && not (Node.failN1 node) &&
not (Instance.isOffline inst) ==>
case Node.addPri node inst'' of
Bad Types.FailMem -> True
_ -> False
(Node.addPri node inst'' ==? Bad Types.FailMem)
where inst' = setInstanceSmallerThanNode node inst
inst'' = inst' { Instance.mem = Instance.mem inst }
......@@ -141,9 +139,7 @@ prop_addPriFD node inst =
let inst' = setInstanceSmallerThanNode node inst
inst'' = inst' { Instance.dsk = Instance.dsk inst
, Instance.diskTemplate = dt }
in case Node.addPri node inst'' of
Bad Types.FailDisk -> True
_ -> False
in (Node.addPri node inst'' ==? Bad Types.FailDisk)
-- | Check that adding a primary instance with too many VCPUs fails
-- with type FailCPU.
......
......@@ -122,7 +122,7 @@ cpuEff :: Cluster.CStats -> Double
cpuEff = effFn Cluster.csIcpu (fromIntegral . Cluster.csVcpu)
-- | Holds data for converting a 'Cluster.CStats' structure into
-- detailed statictics.
-- detailed statistics.
statsData :: [(String, Cluster.CStats -> String)]
statsData = [ ("SCORE", printf "%.8f" . Cluster.csScore)
, ("INST_CNT", printf "%d" . Cluster.csNinst)
......
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