A lot of our tests work by generating a node and a strictly smaller instance and then continue under the assumption that the instance will fit on the node. To obtain a strictly smaller instance, we take an instance of size at most half the free resources of the node. The problem with this approach is that we also require minimal resources of an instance (for examples to be realistic); now, this can lead to an upper bound lower than the lower bound and, by the way QuickCheck's `choose` works, still a value between these bounds is chosen, violating the assumptions about node and instance sizes.
To avoid those problems, set the minimal resources of an allocatable node so that half of them is still bigger than the minimal resources of an instance. Signed-off-by: Klaus Aehlig <[email protected]> --- test/hs/Test/Ganeti/HTools/Node.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/hs/Test/Ganeti/HTools/Node.hs b/test/hs/Test/Ganeti/HTools/Node.hs index 6219901..0960d26 100644 --- a/test/hs/Test/Ganeti/HTools/Node.hs +++ b/test/hs/Test/Ganeti/HTools/Node.hs @@ -114,10 +114,10 @@ genOnlineNode :: Gen Node.Node genOnlineNode = arbitrary `suchThat` (\n -> not (Node.offline n) && not (Node.failN1 n) && - Node.availDisk n > 0 && - Node.availMem n > 0 && - Node.availCpu n > 0 && - Node.tSpindles n > 0) + Node.availDisk n > 2 * Types.unitDsk && + Node.availMem n > 2 * Types.unitMem && + Node.availCpu n > 2 && + Node.tSpindles n > 2) -- | Helper function to generate a sane empty node with consistent -- internal data. -- 2.6.0.rc2.230.g3dd15c0
