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

Split the Node_addOffline test into pri/sec



Currently, this (single) test checks whether we can add an instance as
primary and secondary to a given node. This won't work for instance
templates other than DRBD8, so we split it into:

- an add to primary test, which should work for all disk templates
- an add to secondary test, for which we set the disk template to DRBD
  explicitly
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 5f4464db
......@@ -998,14 +998,27 @@ prop_Node_addSec node inst pdx =
-- | Check that an offline instance with reasonable disk size but
-- extra mem/cpu can always be added.
prop_Node_addOffline (NonNegative extra_mem) (NonNegative extra_cpu) pdx =
prop_Node_addOfflinePri (NonNegative extra_mem) (NonNegative extra_cpu) =
forAll genOnlineNode $ \node ->
forAll (genInstanceSmallerThanNode node) $ \inst ->
let inst' = inst { Instance.runSt = Types.AdminOffline
, Instance.mem = Node.availMem node + extra_mem
, Instance.vcpus = Node.availCpu node + extra_cpu }
in case (Node.addPri node inst', Node.addSec node inst' pdx) of
(Types.OpGood _, Types.OpGood _) -> property True
in case Node.addPri node inst' of
Types.OpGood _ -> property True
v -> failTest $ "Expected OpGood, but got: " ++ show v
-- | Check that an offline instance with reasonable disk size but
-- extra mem/cpu can always be added.
prop_Node_addOfflineSec (NonNegative extra_mem) (NonNegative extra_cpu) pdx =
forAll genOnlineNode $ \node ->
forAll (genInstanceSmallerThanNode node) $ \inst ->
let inst' = inst { Instance.runSt = Types.AdminOffline
, Instance.mem = Node.availMem node + extra_mem
, Instance.vcpus = Node.availCpu node + extra_cpu
, Instance.diskTemplate = Types.DTDrbd8 }
in case Node.addSec node inst' pdx of
Types.OpGood _ -> property True
v -> failTest $ "Expected OpGood/OpGood, but got: " ++ show v
-- | Checks for memory reservation changes.
......@@ -1102,7 +1115,8 @@ testSuite "Node"
, 'prop_Node_addPriFD
, 'prop_Node_addPriFC
, 'prop_Node_addSec
, 'prop_Node_addOffline
, 'prop_Node_addOfflinePri
, 'prop_Node_addOfflineSec
, 'prop_Node_rMem
, 'prop_Node_setMdsk
, 'prop_Node_tagMaps_idempotent
......
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