From 7b8b411ea7bfc9040b883d17d2349c3d013dfec7 Mon Sep 17 00:00:00 2001
From: Klaus Aehlig
Date: Tue, 8 Dec 2015 17:05:10 +0100
Subject: [PATCH] Increase minimal sizes of test online nodes
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
Reviewed-by: Lisa Velden
Cherry-picked-from: 6ccf05c1507c58e
Signed-off-by: Klaus Aehlig
Reviewed-by: Hrvoje Ribicic
---
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
--
1.7.10.4