Commit b99d1638 authored by Iustin Pop's avatar Iustin Pop
Browse files

Fix unittest bug related to offline instances



Currently, the code in Node.hs is overly strict: once a node's free
memory reaches 0, it will refuse to add any instances (offline or
not). I think this is a safe safeguard (I don't expect nodes to run
without at least 1MB of free memory), so rather than change this
behaviour we need to restrict the Node generation in the unittest to
skip such nodes.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarAgata Murawska <agatamurawska@google.com>
parent ebf38064
...@@ -718,7 +718,8 @@ prop_Node_addSec node inst pdx = ...@@ -718,7 +718,8 @@ prop_Node_addSec node inst pdx =
-- | Check that an offline instance with reasonable disk size can always -- | Check that an offline instance with reasonable disk size can always
-- be added. -- be added.
prop_Node_addPriOffline node = prop_Node_addPriOffline =
forAll (arbitrary `suchThat` ((> 0) . Node.fMem)) $ \node ->
forAll (arbitrary `suchThat` forAll (arbitrary `suchThat`
(\ x -> (Instance.dsk x < Node.fDsk node) && (\ x -> (Instance.dsk x < Node.fDsk node) &&
Instance.instanceOffline x)) $ \inst -> Instance.instanceOffline x)) $ \inst ->
...@@ -726,7 +727,8 @@ prop_Node_addPriOffline node = ...@@ -726,7 +727,8 @@ prop_Node_addPriOffline node =
Types.OpGood _ -> True Types.OpGood _ -> True
_ -> False _ -> False
prop_Node_addSecOffline node pdx = prop_Node_addSecOffline pdx =
forAll (arbitrary `suchThat` ((> 0) . Node.fMem)) $ \node ->
forAll (arbitrary `suchThat` forAll (arbitrary `suchThat`
(\ x -> (Instance.dsk x < Node.fDsk node) && (\ x -> (Instance.dsk x < Node.fDsk node) &&
Instance.instanceOffline x)) $ \inst -> Instance.instanceOffline x)) $ \inst ->
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment