Revision bdb7dbbb htest/Test/Ganeti/HTools/Instance.hs

b/htest/Test/Ganeti/HTools/Instance.hs
31 31
  , genInstanceSmallerThanNode
32 32
  , genInstanceMaybeBiggerThanNode
33 33
  , genInstanceSmallerThan
34
  , genInstanceList
34 35
  , Instance.Instance(..)
35 36
  ) where
36 37

  
......
43 44
import Ganeti.BasicTypes
44 45
import qualified Ganeti.HTools.Instance as Instance
45 46
import qualified Ganeti.HTools.Node as Node
47
import qualified Ganeti.HTools.Loader as Loader
46 48
import qualified Ganeti.HTools.Types as Types
47 49

  
48 50
-- * Arbitrary instances
......
74 76
                         (Node.availDisk node + Types.unitDsk * 3)
75 77
                         (Node.availCpu  node + Types.unitCpu * 4)
76 78

  
79
-- | Generates an instance list given an instance generator.
80
genInstanceList :: Gen Instance.Instance -> Gen Instance.List
81
genInstanceList igen = fmap (snd . Loader.assignIndices) names_instances
82
    where names_instances =
83
            (fmap . map) (\n -> (Instance.name n, n)) $ listOf igen
84

  
77 85
-- let's generate a random instance
78 86
instance Arbitrary Instance.Instance where
79 87
  arbitrary = genInstanceSmallerThan maxMem maxDsk maxCpu

Also available in: Unified diff