Revision 7dd5ee6c

b/Ganeti/HTools/QC.hs
1 1
module Ganeti.HTools.QC
2
    where
2
    ( test_PeerMap
3
    , test_Container
4
    , test_Instance
5
    , test_Node
6
    ) where
3 7

  
4 8
import Test.QuickCheck
9
import Test.QuickCheck.Batch
5 10
import Data.Maybe
6 11
import qualified Ganeti.HTools.CLI as CLI
7 12
import qualified Ganeti.HTools.Cluster as Cluster
......
81 86
    where _types = pmap::PeerMap.PeerMap
82 87
          puniq = PeerMap.accumArray const pmap
83 88

  
89
test_PeerMap =
90
    [ run prop_PeerMap_addIdempotent
91
    , run prop_PeerMap_removeIdempotent
92
    , run prop_PeerMap_maxElem
93
    , run prop_PeerMap_addFind
94
    , run prop_PeerMap_findMissing
95
    ]
96

  
84 97
-- Container tests
85 98

  
86 99
prop_Container_addTwo cdata i1 i2 =
......
91 104
          cont = foldl (\c x -> Container.add x x c) Container.empty cdata
92 105
          fn x1 x2 = Container.addTwo x1 x1 x2 x2
93 106

  
107
test_Container =
108
    [ run prop_Container_addTwo ]
94 109

  
95 110
-- Simple instance tests, we only have setter/getters
96 111

  
......
115 130
    where _types = (inst::Instance.Instance, pdx::Types.Ndx, sdx::Types.Ndx)
116 131
          si = Instance.setBoth inst pdx sdx
117 132

  
133
test_Instance =
134
    [ run prop_Instance_setIdx
135
    , run prop_Instance_setName
136
    , run prop_Instance_setPri
137
    , run prop_Instance_setSec
138
    , run prop_Instance_setBoth
139
    ]
140

  
141
-- Node tests
142

  
118 143
-- | Check that an instance add with too high memory or disk will be rejected
119 144
prop_Node_addPri node inst = (Instance.mem inst >= Node.f_mem node ||
120 145
                              Instance.dsk inst >= Node.f_dsk node) &&
......
131 156
    (not $ Node.failN1 node)
132 157
    ==> isNothing(Node.addSec node inst pdx)
133 158
        where _types = (node::Node.Node, inst::Instance.Instance, pdx::Int)
159

  
160
test_Node =
161
    [ run prop_Node_addPri
162
    , run prop_Node_addSec
163
    ]
b/test.hs
13 13
      , debug_tests         = False }
14 14

  
15 15
main = do
16
  runTests "PeerMap" options
17
       [ run prop_PeerMap_addIdempotent
18
       , run prop_PeerMap_removeIdempotent
19
       , run prop_PeerMap_maxElem
20
       , run prop_PeerMap_addFind
21
       , run prop_PeerMap_findMissing
22
       ]
23

  
24
  runTests "Container" options
25
       [ run prop_Container_addTwo ]
26

  
27
  runTests "Instance" options
28
       [ run prop_Instance_setIdx
29
       , run prop_Instance_setName
30
       , run prop_Instance_setPri
31
       , run prop_Instance_setSec
32
       , run prop_Instance_setBoth
33
       ]
34

  
35
  runTests "Node" options
36
       [ run prop_Node_addPri
37
       , run prop_Node_addSec
38
       ]
16
  runTests "PeerMap" options test_PeerMap
17
  runTests "Container" options test_Container
18
  runTests "Instance" options test_Instance
19
  runTests "Node" options test_Node

Also available in: Unified diff