From c3a8e06dced90716dbe40bea8a1b22eb77e20b22 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Fri, 7 Sep 2012 05:57:41 +0900 Subject: [PATCH] Fix arbitrary ConfigData object generation The Cluster object, as it is defined right now, has many '[String]' members, which means that in a standard arbitrary generator these will become very big, which is the reason for the current slowness of the test 'Config_serialisation'. By resizing the generator to 8 (arbitrary chosen to limit the list length and the string sizes), and by reducing a bit the node count, we can make this test be as fast as the others (about 10x improvement). This means we can test more cases, for the same cost. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Guido Trotter <ultrotter@google.com> --- htest/Test/Ganeti/Objects.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htest/Test/Ganeti/Objects.hs b/htest/Test/Ganeti/Objects.hs index 9835d57ca..b66d0ef6d 100644 --- a/htest/Test/Ganeti/Objects.hs +++ b/htest/Test/Ganeti/Objects.hs @@ -187,7 +187,7 @@ genEmptyCluster ncount = do grp <- arbitrary let contgroups = Container $ Map.singleton guuid grp serial <- arbitrary - cluster <- arbitrary + cluster <- resize 8 arbitrary let c = ConfigData version cluster contnodes contgroups continsts serial return c @@ -227,7 +227,7 @@ prop_Inst_serialisation = testSerialisation -- | Check config serialisation. prop_Config_serialisation :: Property prop_Config_serialisation = - forAll (choose (0, maxNodes) >>= genEmptyCluster) testSerialisation + forAll (choose (0, maxNodes `div` 4) >>= genEmptyCluster) testSerialisation testSuite "Objects" [ 'prop_fillDict -- GitLab