Safe Haskell | None |
---|
Unittests for ganeti-htools.
Synopsis
- makeSmallEmptyCluster :: Node -> Int -> Instance -> (List, List, Instance)
- isNodeBig :: Int -> Node -> Bool
- canBalance :: Table -> Bool -> Bool -> Bool -> Bool
- assignInstance :: List -> List -> Instance -> Idx -> Idx -> (List, List)
- isMirrored :: Instance -> Bool
- evacModeOptions :: MirrorType -> [EvacMode]
- prop_Score_Zero :: Node -> Property
- prop_CStats_sane :: Property
- prop_Alloc_sane :: Instance -> Property
- prop_CanTieredAlloc :: Property
- genClusterAlloc :: Int -> Node -> Instance -> Result (List, List, Instance)
- prop_AllocRelocate :: Property
- check_EvacMode :: Group -> Instance -> Result (List, List, EvacSolution) -> Property
- prop_AllocEvacuate :: Property
- prop_AllocChangeGroup :: Property
- prop_AllocBalance :: Property
- prop_CheckConsistency :: Node -> Instance -> Bool
- prop_SplitCluster :: Node -> Instance -> Property
- canAllocOn :: List -> Int -> Instance -> Maybe String
- prop_AllocPolicy :: Property
- testHTools_Cluster :: Test
Helpers
makeSmallEmptyCluster :: Node -> Int -> Instance -> (List, List, Instance) Source #
Make a small cluster, both nodes and instances.
canBalance :: Table -> Bool -> Bool -> Bool -> Bool Source #
assignInstance :: List -> List -> Instance -> Idx -> Idx -> (List, List) Source #
Assigns a new fresh instance to a cluster; this is not allocation, so no resource checks are done.
isMirrored :: Instance -> Bool Source #
Checks if an instance is mirrored.
evacModeOptions :: MirrorType -> [EvacMode] Source #
Returns the possible change node types for a disk template.
Test cases
prop_Score_Zero :: Node -> Property Source #
Check that the cluster score is close to zero for a homogeneous cluster.
prop_CStats_sane :: Property Source #
Check that cluster stats are sane.
prop_Alloc_sane :: Instance -> Property Source #
Check that one instance is allocated correctly on an empty cluster, without rebalances needed.
prop_CanTieredAlloc :: Property Source #
Checks that on a 2-5 node cluster, we can allocate a random instance spec via tiered allocation (whatever the original instance spec), on either one or two nodes. Furthermore, we test that computed allocation statistics are correct.
genClusterAlloc :: Int -> Node -> Instance -> Result (List, List, Instance) Source #
Helper function to create a cluster with the given range of nodes and allocate an instance on it.
prop_AllocRelocate :: Property Source #
Checks that on a 4-8 node cluster, once we allocate an instance, we can also relocate it.
check_EvacMode :: Group -> Instance -> Result (List, List, EvacSolution) -> Property Source #
Helper property checker for the result of a nodeEvac or changeGroup operation.
prop_AllocEvacuate :: Property Source #
Checks that on a 4-8 node cluster, once we allocate an instance, we can also node-evacuate it.
prop_AllocChangeGroup :: Property Source #
Checks that on a 4-8 node cluster with two node groups, once we allocate an instance on the first node group, we can also change its group.
prop_AllocBalance :: Property Source #
Check that allocating multiple instances on a cluster, then adding an empty node, results in a valid rebalance.
prop_CheckConsistency :: Node -> Instance -> Bool Source #
Checks consistency.
prop_SplitCluster :: Node -> Instance -> Property Source #
For now, we only test that we don't lose instances during the split.
canAllocOn :: List -> Int -> Instance -> Maybe String Source #
Helper function to check if we can allocate an instance on a
given node list. Successful allocation is denoted by Nothing
,
otherwise the Just
value will contain the error message.
prop_AllocPolicy :: Property Source #
Checks that allocation obeys minimum and maximum instance policies. The unittest generates a random node, duplicates it count times, and generates a random instance that can be allocated on this mini-cluster; it then checks that after applying a policy that the instance doesn't fits, the allocation fails.
testHTools_Cluster :: Test Source #