Commit 591fa888 authored by Iustin Pop's avatar Iustin Pop
Browse files

Extend the hbal shell tests



After this patch, almost all of hbal except the actual Luxi execution
is being covered by unit- or shelltests.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 108c0a3e
......@@ -878,6 +878,7 @@ TEST_FILES = \
htest/data/hbal-split-insts.data \
htest/data/invalid-node.data \
htest/data/missing-resources.data \
htest/data/n1-failure.data \
htest/data/rapi/groups.json \
htest/data/rapi/info.json \
htest/data/rapi/instances.json \
......
group-01|fake-uuid-01|preferred|
group-02|fake-uuid-02|unallocable|
node-01-001|256|0|0|7629394|7625298|16|N|fake-uuid-01|1
node-01-002|256|0|0|7629394|7625298|16|N|fake-uuid-01|1
node-01-003|256|0|0|7629394|7625298|16|N|fake-uuid-01|1
node-01-004|256|0|0|7629394|7625298|16|N|fake-uuid-01|1
node-02-001|65536|0|65536|7629394|7629394|16|N|fake-uuid-01|1
node-02-002|65536|0|65536|7629394|7629394|16|N|fake-uuid-01|1
node-02-003|65536|0|65536|7629394|7629394|16|N|fake-uuid-01|1
node-02-004|65536|0|65536|7629394|7629394|16|N|fake-uuid-01|1
new-0|128|1024|1|running|Y|node-01-004|node-01-003|drbd||1
new-1|128|1024|1|running|Y|node-01-002|node-01-001|drbd||1
new-2|128|1024|1|running|Y|node-01-003|node-01-001|drbd||1
new-3|128|1024|1|running|Y|node-01-001|node-01-004|drbd||1
new-4|128|1024|1|running|Y|node-01-002|node-01-004|drbd||1
new-5|128|1024|1|running|Y|node-01-003|node-01-002|drbd||1
new-6|128|1024|1|running|Y|node-01-004|node-01-002|drbd||1
new-7|128|1024|1|running|Y|node-01-001|node-01-003|drbd||1
|128,1,1024,1,1,1|128,1,1024,1,1,1|32768,8,1048576,16,8,12|diskless,file,sharedfile,plain,blockdev,drbd,rbd,ext|4.0|32.0
group-01|128,1,1024,1,1,1|128,1,1024,1,1,1|32768,8,1048576,16,8,12|diskless,file,sharedfile,plain,blockdev,drbd,rbd,ext|4.0|32.0
group-02|128,1,1024,1,1,1|128,1,1024,1,1,1|32768,8,1048576,16,8,12|diskless,file,sharedfile,plain,blockdev,drbd,rbd,ext|4.0|32.0
......@@ -13,6 +13,18 @@
>>> /gnt-instance (failover|migrate|replace-disks)/
>>>= 0
# test that hbal won't execute rebalances when using the text backend
./htest/hbal $BACKEND_BAL_STD -G group-01 -X
>>>2
Error: hbal: Execution of commands possible only on LUXI
>>>= !0
# test that hbal won't execute any moves if we request an absurdly-high
# minimum-improvement
./htest/hbal $BACKEND_BAL_STD -G group-01 -C --min-gain 10000 --min-gain-limit 10000
>>>/No solution found/
>>>= 0
# test saving commands
./htest/hbal $BACKEND_BAL_STD -G group-01 -C$T/rebal-cmds.standard
>>>= 0
......@@ -70,3 +82,22 @@ diff -u $T/simu-rebal-merged.tiered $T/simu-rebal.tiered.original
./htest/hbal -t $T/simu-rebal.tiered.balanced -G group-01
>>> /(Nothing to do, exiting|No solution found)/
>>>= 0
### now some other custom tests
# n+1 bad instances are reported as such
./htest/hbal -t$TESTDATA_DIR/n1-failure.data -G group-01
>>>/Initial check done: 4 bad nodes, 8 bad instances./
>>>=0
# same test again, different message check (shelltest can't test multiple
# messages via regexp
./htest/hbal -t$TESTDATA_DIR/n1-failure.data -G group-01
>>>/Cluster is not N\+1 happy, continuing but no guarantee that the cluster will end N\+1 happy./
>>>2
>>>=0
# hbal should work on empty groups as well
./htest/hbal -t$TESTDATA_DIR/n1-failure.data -G group-02
>>>/Group size 0 nodes, 0 instances/
>>>= 0
......@@ -39,7 +39,9 @@
>>> /HCHECK_OK=1/
>>>= 0
# hcheck should be able to improve a group with split instances
./htest/hbal -t $TESTDATA_DIR/hbal-split-insts.data -G group-01 -O node-01-001
# hcheck should be able to improve a group with split instances, and also
# warn us about them
./htest/hbal -t $TESTDATA_DIR/hbal-split-insts.data -G group-01 -O node-01-001 -v
>>> /Cluster score improved from .* to .*/
>>>2/Found instances belonging to multiple node groups:/
>>>= 0
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