Statistics
| Branch: | Tag: | Revision:

root / htest / shelltests / htools-balancing.test @ c64c3854

History | View | Annotate | Download (3.7 kB)

1
### std tests
2

    
3
# test basic parsing
4
./htest/hinfo -v -v -p --print-instances $BACKEND_BAL_STD
5
>>>= 0
6
./htest/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
./htest/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 hbal won't execute rebalances when using the text backend
17
./htest/hbal $BACKEND_BAL_STD -G group-01 -X
18
>>>2
19
Error: hbal: Execution of commands possible only on LUXI
20
>>>= !0
21

    
22
# test that hbal won't execute any moves if we request an absurdly-high
23
# minimum-improvement
24
./htest/hbal $BACKEND_BAL_STD -G group-01 -C --min-gain 10000 --min-gain-limit 10000
25
>>>/No solution found/
26
>>>= 0
27

    
28
# test saving commands
29
./htest/hbal $BACKEND_BAL_STD -G group-01 -C$T/rebal-cmds.standard
30
>>>= 0
31
# and now check the file (depends on previous test)
32
cat $T/rebal-cmds.standard
33
>>> /gnt-instance (failover|migrate|replace-disks)/
34
>>>= 0
35

    
36
# state saved before rebalancing should be identical; depends on the
37
# previous test
38
diff -u $T/simu-rebal-merged.standard $T/simu-rebal.standard.original
39
>>>
40
>>>= 0
41

    
42
# no double rebalance; depends on previous test
43
./htest/hbal -t $T/simu-rebal.standard.balanced -G group-01
44
>>> /(Nothing to do, exiting|No solution found)/
45
>>>= 0
46

    
47
# hcheck sees no reason to rebalance after rebalancing was already done
48
./htest/hcheck -t$T/simu-rebal.standard.balanced --machine-readable
49
>>> /HCHECK_INIT_CLUSTER_NEED_REBALANCE=0/
50
>>>= 0
51

    
52
### now tiered tests
53

    
54
# test basic parsing
55
./htest/hinfo -v -v -p --print-instances $BACKEND_BAL_TIER
56
>>>= 0
57
./htest/hbal -v -v -v -p --print-instances $BACKEND_BAL_TIER -G group-01
58
>>> !/(Nothing to do, exiting|No solution found)/
59
>>>2 !/(Nothing to do, exiting|No solution found)/
60
>>>= 0
61

    
62
# test command output
63
./htest/hbal $BACKEND_BAL_TIER -G group-01 -C -S $T/simu-rebal.tiered
64
>>> /gnt-instance (failover|migrate|replace-disks)/
65
>>>= 0
66

    
67
# test saving commands
68
./htest/hbal $BACKEND_BAL_TIER -G group-01 -C$T/rebal-cmds.tiered
69
>>>= 0
70
# and now check the file (depends on previous test)
71
cat $T/rebal-cmds.tiered
72
>>> /gnt-instance (failover|migrate|replace-disks)/
73
>>>= 0
74

    
75
# state saved before rebalancing should be identical; depends on the
76
# previous test
77
diff -u $T/simu-rebal-merged.tiered $T/simu-rebal.tiered.original
78
>>>
79
>>>= 0
80

    
81
# no double rebalance; depends on previous test
82
./htest/hbal -t $T/simu-rebal.tiered.balanced -G group-01
83
>>> /(Nothing to do, exiting|No solution found)/
84
>>>= 0
85

    
86
### now some other custom tests
87

    
88
# n+1 bad instances are reported as such
89
./htest/hbal -t$TESTDATA_DIR/n1-failure.data -G group-01
90
>>>/Initial check done: 4 bad nodes, 8 bad instances./
91
>>>=0
92

    
93
# same test again, different message check (shelltest can't test multiple
94
# messages via regexp
95
./htest/hbal -t$TESTDATA_DIR/n1-failure.data -G group-01
96
>>>/Cluster is not N\+1 happy, continuing but no guarantee that the cluster will end N\+1 happy./
97
>>>2
98
>>>=0
99

    
100
# and hcheck should report this as needs rebalancing
101
./htest/hcheck -t$TESTDATA_DIR/n1-failure.data
102
>>>/Cluster needs rebalancing./
103
>>>= 1
104

    
105
# ... unless we request no-simulation mode
106
./htest/hcheck -t$TESTDATA_DIR/n1-failure.data --no-simulation
107
>>>/Running in no-simulation mode./
108
>>>= 0
109

    
110
# and a clean cluster should be reported as such
111
./htest/hcheck $BACKEND_BAL_STD
112
>>>/No need to rebalance cluster, no problems found./
113
>>>= 0
114

    
115
# ... and even one with non-zero score
116
./htest/hcheck -t $TESTDATA_DIR/clean-nonzero-score.data
117
>>>/No need to rebalance cluster, no problems found./
118
>>>= 0
119

    
120
# hbal should work on empty groups as well
121
./htest/hbal -t$TESTDATA_DIR/n1-failure.data -G group-02
122
>>>/Group size 0 nodes, 0 instances/
123
>>>= 0