Revision 030ab01a test/hs/Test/Ganeti/Rpc.hs

b/test/hs/Test/Ganeti/Rpc.hs
40 40

  
41 41
import qualified Ganeti.Rpc as Rpc
42 42
import qualified Ganeti.Objects as Objects
43
import qualified Ganeti.Types as Types
44
import qualified Ganeti.JSON as JSON
43 45

  
44 46
instance Arbitrary Rpc.RpcCallAllInstancesInfo where
45 47
  arbitrary = Rpc.RpcCallAllInstancesInfo <$> arbitrary
......
48 50
  arbitrary = Rpc.RpcCallInstanceList <$> arbitrary
49 51

  
50 52
instance Arbitrary Rpc.RpcCallNodeInfo where
51
  arbitrary = Rpc.RpcCallNodeInfo <$> arbitrary <*> arbitrary <*>
53
  arbitrary = Rpc.RpcCallNodeInfo <$> arbitrary <*> genHvSpecs <*>
52 54
                pure Map.empty
53 55

  
56
-- | Generate hypervisor specifications to be used for the NodeInfo call
57
genHvSpecs :: Gen [ (Types.Hypervisor, Objects.HvParams) ]
58
genHvSpecs = do
59
  numhv <- choose (0, 5)
60
  hvs <- vectorOf numhv arbitrary
61
  hvparams <- vectorOf numhv genHvParams
62
  let specs = zip hvs hvparams
63
  return specs
64

  
65
-- FIXME: Generate more interesting hvparams
66
-- | Generate Hvparams
67
genHvParams :: Gen Objects.HvParams
68
genHvParams = return $ JSON.GenericContainer Map.empty
69

  
54 70
-- | Monadic check that, for an offline node and a call that does not
55 71
-- offline nodes, we get a OfflineNodeError response.
56 72
-- FIXME: We need a way of generalizing this, running it for

Also available in: Unified diff