Revision 76a0266e htest/Test/Ganeti/Objects.hs

b/htest/Test/Ganeti/Objects.hs
38 38
import qualified Data.Map as Map
39 39
import qualified Data.Set as Set
40 40

  
41
import Test.Ganeti.Query.Language (genJSValue)
41 42
import Test.Ganeti.TestHelper
42 43
import Test.Ganeti.TestCommon
43 44
import Test.Ganeti.Types ()
......
162 163

  
163 164
$(genArbitrary ''Cluster)
164 165

  
166
instance Arbitrary Network where
167
  arbitrary = Network <$>
168
                        -- name
169
                        arbitrary
170
                        -- network_type
171
                        <*> arbitrary
172
                        -- mac_prefix
173
                        <*> arbitrary
174
                        -- family
175
                        <*> arbitrary
176
                        -- network
177
                        <*> arbitrary
178
                        -- network6
179
                        <*> arbitrary
180
                        -- gateway
181
                        <*> arbitrary
182
                        -- gateway6
183
                        <*> arbitrary
184
                        -- size
185
                        <*> genMaybe genJSValue
186
                        -- reservations
187
                        <*> arbitrary
188
                        -- external reservations
189
                        <*> arbitrary
190
                        -- serial
191
                        <*> arbitrary
192
                        -- tags
193
                        <*> (Set.fromList <$> genTags)
194

  
165 195
-- | Generator for config data with an empty cluster (no instances),
166 196
-- with N defined nodes.
167 197
genEmptyCluster :: Int -> Gen ConfigData
......
222 252
prop_Inst_serialisation :: Instance -> Property
223 253
prop_Inst_serialisation = testSerialisation
224 254

  
255
-- | Check that network serialisation is idempotent.
256
prop_Network_serialisation :: Network -> Property
257
prop_Network_serialisation = testSerialisation
258

  
225 259
-- | Check config serialisation.
226 260
prop_Config_serialisation :: Property
227 261
prop_Config_serialisation =
......
231 265
  [ 'prop_fillDict
232 266
  , 'prop_Disk_serialisation
233 267
  , 'prop_Inst_serialisation
268
  , 'prop_Network_serialisation
234 269
  , 'prop_Node_serialisation
235 270
  , 'prop_Config_serialisation
236 271
  ]

Also available in: Unified diff