From 309e7c9a6b5e6b83395253fef033af9df49fefbf Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Mon, 20 Jun 2011 15:28:57 +0200 Subject: [PATCH] htools: fix corner case in prop_Text_Load_Instance This unittest had a corner case where it could fail if the same primary/secondary node names were generated. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- htools/Ganeti/HTools/QC.hs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/htools/Ganeti/HTools/QC.hs b/htools/Ganeti/HTools/QC.hs index 07fe94396..c3f4d4aa8 100644 --- a/htools/Ganeti/HTools/QC.hs +++ b/htools/Ganeti/HTools/QC.hs @@ -476,15 +476,13 @@ testInstance = prop_Text_Load_Instance name mem dsk vcpus status (NonEmpty pnode) snode (NonNegative pdx) (NonNegative sdx) autobal = + pnode /= snode && pdx /= sdx ==> let vcpus_s = show vcpus dsk_s = show dsk mem_s = show mem - rsdx = if pdx == sdx - then sdx + 1 - else sdx ndx = if null snode then [(pnode, pdx)] - else [(pnode, pdx), (snode, rsdx)] + else [(pnode, pdx), (snode, sdx)] nl = Data.Map.fromList ndx tags = "" sbal = if autobal then "Y" else "N" @@ -508,7 +506,7 @@ prop_Text_Load_Instance name mem dsk vcpus status Instance.pNode i == pdx && Instance.sNode i == (if null snode then Node.noSecondary - else rsdx) && + else sdx) && Instance.auto_balance i == autobal && isNothing fail1 -- GitLab