Safe Haskell | None |
---|
Unittests for ganeti-htools.
Synopsis
- genNode :: Maybe Int -> Maybe Int -> Gen Node
- genOnlineNode :: Gen Node
- genEmptyOnlineNode :: Gen Node
- genExclStorNode :: Gen Node
- genMaybeExclStorNode :: Gen Node
- genNodeList :: Gen Node -> Gen List
- genUniqueNodeList :: Gen Node -> Gen (List, NameAssoc)
- genNodeGraph :: Gen (Maybe Graph, List, List)
- prop_setAlias :: Node -> String -> Bool
- prop_setOffline :: Node -> Bool -> Property
- prop_setMcpu :: Node -> Double -> Property
- prop_addPri_NoN1Fail :: Property
- prop_addPriFM :: Node -> Instance -> Property
- prop_addPriFD :: Instance -> Property
- hasInstTooManySpindles :: Instance -> Int -> Bool
- prop_addPriFS :: Instance -> Property
- prop_addPriFC :: Property
- prop_addSec :: Node -> Instance -> Int -> Property
- prop_addOfflinePri :: NonNegative Int -> NonNegative Int -> Property
- prop_addOfflineSec :: NonNegative Int -> NonNegative Int -> Ndx -> Property
- prop_rMem :: Instance -> Property
- prop_setMdsk :: Node -> SmallRatio -> Bool
- prop_tagMaps_idempotent :: Property
- prop_tagMaps_reject :: Property
- prop_showField :: Node -> Property
- prop_computeGroups :: [Node] -> Bool
- prop_addPri_idempotent :: Property
- prop_addSec_idempotent :: Property
- case_emptyNodeList :: Assertion
- prop_numVertices :: Property
- prop_numEdges :: Property
- prop_nodeGraphIsColorable :: Property
- prop_instanceIsEdge :: Property
- prop_edgeIsInstance :: Property
- testHTools_Node :: Test
Arbitrary instances
:: Maybe Int | Minimum node size in terms of units |
-> Maybe Int | Maximum node size (when Nothing, bounded just by the max... constants) |
-> Gen Node |
Generates an arbitrary node based on sizing information.
genOnlineNode :: Gen Node Source #
Helper function to generate a sane node.
genEmptyOnlineNode :: Gen Node Source #
Helper function to generate a sane empty node with consistent internal data.
genExclStorNode :: Gen Node Source #
Generate a node with exclusive storage enabled.
genMaybeExclStorNode :: Gen Node Source #
Generate a node with exclusive storage possibly enabled.
genNodeList :: Gen Node -> Gen List Source #
Node list generator. Given a node generator, create a random length node list. Note that "real" clusters always have at least one node, so we don't generate empty node lists here.
genUniqueNodeList :: Gen Node -> Gen (List, NameAssoc) Source #
Node list generator where node names are unique
genNodeGraph :: Gen (Maybe Graph, List, List) Source #
Generate a node list, an instance list, and a node graph. We choose instances with nodes contained in the node list.
Test cases
prop_setAlias :: Node -> String -> Bool Source #
prop_setOffline :: Node -> Bool -> Property Source #
prop_setMcpu :: Node -> Double -> Property Source #
prop_addPri_NoN1Fail :: Property Source #
prop_addPriFM :: Node -> Instance -> Property Source #
Check that an instance add with too high memory or disk will be rejected.
prop_addPriFD :: Instance -> Property Source #
Check that adding a primary instance with too much disk fails with type FailDisk.
hasInstTooManySpindles :: Instance -> Int -> Bool Source #
Check if an instance exceeds a spindles limit or has no spindles set.
prop_addPriFS :: Instance -> Property Source #
Check that adding a primary instance with too many spindles fails with type FailSpindles (when exclusive storage is enabled).
prop_addPriFC :: Property Source #
Check that adding a primary instance with too many VCPUs fails with type FailCPU.
prop_addSec :: Node -> Instance -> Int -> Property Source #
Check that an instance add with too high memory or disk will be rejected.
prop_addOfflinePri :: NonNegative Int -> NonNegative Int -> Property Source #
Check that an offline instance with reasonable disk size but extra mem/cpu can always be added.
prop_addOfflineSec :: NonNegative Int -> NonNegative Int -> Ndx -> Property Source #
Check that an offline instance with reasonable disk size but extra mem/cpu can always be added.
prop_setMdsk :: Node -> SmallRatio -> Bool Source #
Check mdsk setting.
prop_tagMaps_idempotent :: Property Source #
prop_tagMaps_reject :: Property Source #
prop_showField :: Node -> Property Source #
prop_computeGroups :: [Node] -> Bool Source #
prop_addPri_idempotent :: Property Source #
prop_addSec_idempotent :: Property Source #
case_emptyNodeList :: Assertion Source #
Check that no graph is created on an empty node list.
prop_numVertices :: Property Source #
Check that the number of vertices of a nodegraph is equal to the number of nodes in the original node list.
prop_numEdges :: Property Source #
Check that the number of edges of a nodegraph is equal to twice the number of instances with secondary nodes in the original instance list.
prop_nodeGraphIsColorable :: Property Source #
Check that a node graph is colorable.
prop_instanceIsEdge :: Property Source #
Check that each edge in a nodegraph is an instance.
prop_edgeIsInstance :: Property Source #
Check that each instance in an edge in the resulting nodegraph.
testHTools_Node :: Test Source #
List of tests for the Node module.