Annotate every arbitrary instance field
authorHelga Velroyen <helgav@google.com>
Wed, 15 May 2013 13:01:28 +0000 (15:01 +0200)
committerHelga Velroyen <helgav@google.com>
Wed, 15 May 2013 14:43:51 +0000 (16:43 +0200)
The Arbitrary instance of the 'Instance' object is written
using the <*> syntax. Since it often uses the 'arbitrary'
generator for the instance's fields it is hard to figure
out which 'arbitrary' fills which instance field. This
patch annotates all fields with their name to make
maintenance of this code easier.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>

test/hs/Test/Ganeti/Objects.hs

index 9fdaec4..da4a89d 100644 (file)
@@ -107,13 +107,31 @@ $(genArbitrary ''PartialNic)
 instance Arbitrary Instance where
   arbitrary =
     Instance
-      <$> genFQDN <*> genFQDN <*> genFQDN -- OS name, but...
+      -- name
+      <$> genFQDN
+      -- primary node
+      <*> genFQDN
+      -- OS
+      <*> genFQDN
+      -- hypervisor
       <*> arbitrary
+      -- hvparams
       -- FIXME: add non-empty hvparams when they're a proper type
-      <*> pure (GenericContainer Map.empty) <*> arbitrary
-      -- ... and for OSParams
-      <*> pure (GenericContainer Map.empty) <*> arbitrary <*> arbitrary
-      <*> arbitrary <*> arbitrary <*> arbitrary
+      <*> pure (GenericContainer Map.empty)
+      -- beparams
+      <*> arbitrary
+      -- osparams
+      <*> pure (GenericContainer Map.empty)
+      -- admin_state
+      <*> arbitrary
+      -- nics
+      <*> arbitrary
+      -- disks
+      <*> arbitrary
+      -- disk template
+      <*> arbitrary
+      -- network port
+      <*> arbitrary
       -- ts
       <*> arbitrary <*> arbitrary
       -- uuid