Extend hroller tests by options for non-redundant instances
[ganeti-local] / test / hs / shelltests / htools-balancing.test
1 ### std tests
2
3 # test basic parsing
4 ./test/hs/hinfo -v -v -p --print-instances $BACKEND_BAL_STD
5 >>>= 0
6 ./test/hs/hbal -v -v -v -p --print-instances $BACKEND_BAL_STD -G group-01
7 >>> !/(Nothing to do, exiting|No solution found)/
8 >>>2 !/(Nothing to do, exiting|No solution found)/
9 >>>= 0
10
11 # test command output
12 ./test/hs/hbal $BACKEND_BAL_STD -G group-01 -C -S $T/simu-rebal.standard
13 >>> /gnt-instance (failover|migrate|replace-disks)/
14 >>>= 0
15
16 # test that correct priorities are accepted
17 ./test/hs/hbal $BACKEND_BAL_STD -G group-01 -C -S $T/simu-rebal.standard --prio low
18 >>> /gnt-instance (failover|migrate|replace-disks)/
19 >>>= 0
20
21
22 # test that hbal won't execute rebalances when using the text backend
23 ./test/hs/hbal $BACKEND_BAL_STD -G group-01 -X
24 >>>2
25 Error: hbal: Execution of commands possible only on LUXI
26 >>>= !0
27
28 # test that hbal won't execute any moves if we request an absurdly-high
29 # minimum-improvement
30 ./test/hs/hbal $BACKEND_BAL_STD -G group-01 -C --min-gain 10000 --min-gain-limit 10000
31 >>>/No solution found/
32 >>>= 0
33
34 # test saving commands
35 ./test/hs/hbal $BACKEND_BAL_STD -G group-01 -C$T/rebal-cmds.standard
36 >>>= 0
37 # and now check the file (depends on previous test)
38 cat $T/rebal-cmds.standard
39 >>> /gnt-instance (failover|migrate|replace-disks)/
40 >>>= 0
41
42 # state saved before rebalancing should be identical; depends on the
43 # previous test
44 diff -u $T/simu-rebal-merged.standard $T/simu-rebal.standard.original
45 >>>
46 >>>= 0
47
48 # no double rebalance; depends on previous test
49 ./test/hs/hbal -t $T/simu-rebal.standard.balanced -G group-01
50 >>> /(Nothing to do, exiting|No solution found)/
51 >>>= 0
52
53 # hcheck sees no reason to rebalance after rebalancing was already done
54 ./test/hs/hcheck -t$T/simu-rebal.standard.balanced --machine-readable
55 >>> /HCHECK_INIT_CLUSTER_NEED_REBALANCE=0/
56 >>>= 0
57
58 ### now tiered tests
59
60 # test basic parsing
61 ./test/hs/hinfo -v -v -p --print-instances $BACKEND_BAL_TIER
62 >>>= 0
63 ./test/hs/hbal -v -v -v -p --print-instances $BACKEND_BAL_TIER -G group-01
64 >>> !/(Nothing to do, exiting|No solution found)/
65 >>>2 !/(Nothing to do, exiting|No solution found)/
66 >>>= 0
67
68 # test command output
69 ./test/hs/hbal $BACKEND_BAL_TIER -G group-01 -C -S $T/simu-rebal.tiered
70 >>> /gnt-instance (failover|migrate|replace-disks)/
71 >>>= 0
72
73 # test saving commands
74 ./test/hs/hbal $BACKEND_BAL_TIER -G group-01 -C$T/rebal-cmds.tiered
75 >>>= 0
76 # and now check the file (depends on previous test)
77 cat $T/rebal-cmds.tiered
78 >>> /gnt-instance (failover|migrate|replace-disks)/
79 >>>= 0
80
81 # state saved before rebalancing should be identical; depends on the
82 # previous test
83 diff -u $T/simu-rebal-merged.tiered $T/simu-rebal.tiered.original
84 >>>
85 >>>= 0
86
87 # no double rebalance; depends on previous test
88 ./test/hs/hbal -t $T/simu-rebal.tiered.balanced -G group-01
89 >>> /(Nothing to do, exiting|No solution found)/
90 >>>= 0
91
92 ### now some other custom tests
93
94 # n+1 bad instances are reported as such
95 ./test/hs/hbal -t$TESTDATA_DIR/n1-failure.data -G group-01
96 >>>/Initial check done: 4 bad nodes, 8 bad instances./
97 >>>=0
98
99 # same test again, different message check (shelltest can't test multiple
100 # messages via regexp
101 ./test/hs/hbal -t$TESTDATA_DIR/n1-failure.data -G group-01
102 >>>/Cluster is not N\+1 happy, continuing but no guarantee that the cluster will end N\+1 happy./
103 >>>2
104 >>>=0
105
106 # and hcheck should report this as needs rebalancing
107 ./test/hs/hcheck -t$TESTDATA_DIR/n1-failure.data
108 >>>/Cluster needs rebalancing./
109 >>>= 1
110
111 # ... unless we request no-simulation mode
112 ./test/hs/hcheck -t$TESTDATA_DIR/n1-failure.data --no-simulation
113 >>>/Running in no-simulation mode./
114 >>>= 0
115
116 # and a clean cluster should be reported as such
117 ./test/hs/hcheck $BACKEND_BAL_STD
118 >>>/No need to rebalance cluster, no problems found./
119 >>>= 0
120
121 # ... and even one with non-zero score
122 ./test/hs/hcheck -t $TESTDATA_DIR/clean-nonzero-score.data
123 >>>/No need to rebalance cluster, no problems found./
124 >>>= 0
125
126 # hbal should work on empty groups as well
127 ./test/hs/hbal -t$TESTDATA_DIR/n1-failure.data -G group-02
128 >>>/Group size 0 nodes, 0 instances/
129 >>>= 0