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]> Reviewed-by: Lisa Velden <[email protected]> Cherry-picked-from: 6ccf05c1507c58e 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 9177ba7..d782fe2 100644 --- a/test/hs/Test/Ganeti/HTools/Node.hs +++ b/test/hs/Test/Ganeti/HTools/Node.hs @@ -113,10 +113,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) -- | Generate a node with exclusive storage enabled. genExclStorNode :: Gen Node.Node -- 2.6.0.rc2.230.g3dd15c0
