Statistics
| Branch: | Tag: | Revision:

root / test / hs / shelltests / htools-hail.test @ d7976f54

History | View | Annotate | Download (5.4 kB)

1
# test that on invalid files it can't parse the request
2
./test/hs/hail /dev/null
3
>>>2 /Invalid JSON/
4
>>>= !0
5

    
6
# another invalid example
7
echo '[]' | ./test/hs/hail -
8
>>>2 /Unable to read JSObject/
9
>>>= !0
10

    
11
# empty dict
12
echo '{}' | ./test/hs/hail -
13
>>>2 /key 'request' not found/
14
>>>= !0
15

    
16
echo '{"request": 0}' | ./test/hs/hail -
17
>>>2 /key 'request'/
18
>>>= !0
19

    
20
./test/hs/hail $TESTDATA_DIR/hail-invalid-reloc.json
21
>>>2 /key 'name': Unable to read String/
22
>>>= !0
23

    
24
# and now start the real tests
25
./test/hs/hail $TESTDATA_DIR/hail-alloc-drbd.json
26
>>> /"success":true,.*,"result":\["node2","node1"\]/
27
>>>= 0
28

    
29
./test/hs/hail $TESTDATA_DIR/hail-reloc-drbd.json
30
>>> /"success":true,.*,"result":\["node1"\]/
31
>>>= 0
32

    
33
./test/hs/hail $TESTDATA_DIR/hail-node-evac.json
34
>>> /"success":true,"info":"Request successful: 0 instances failed to move and 1 were moved successfully"/
35
>>>= 0
36

    
37
./test/hs/hail $TESTDATA_DIR/hail-change-group.json
38
>>> /"success":true,"info":"Request successful: 0 instances failed to move and 1 were moved successfully"/
39
>>>= 0
40

    
41
# check that hail correctly applies the disk policy on a per-disk basis
42
./test/hs/hail $TESTDATA_DIR/hail-alloc-twodisks.json
43
>>> /"success":true,.*,"result":\["node1"\]/
44
>>>= 0
45

    
46
./test/hs/hail $TESTDATA_DIR/hail-alloc-invalid-twodisks.json
47
>>> /"success":false,.*FailDisk: 1/
48
>>>= 0
49

    
50
# check that hail honors network requirements
51
./test/hs/hail $TESTDATA_DIR/hail-alloc-restricted-network.json
52
>>> /"success":true,"info":"Request successful: Selected group: Group 1.*/
53
>>>= 0
54

    
55
# check that hail fails if no nodegroup can meet network and disk template requirements
56
./test/hs/hail $TESTDATA_DIR/hail-alloc-invalid-network.json
57
>>> /"success":false,/
58
>>>= 0
59

    
60
# check that hail succeeds with the same test data, but with the network restrictions removed
61
cat $TESTDATA_DIR/hail-alloc-invalid-network.json | grep -v -e '"network":"uuid-net-1-."' | ./test/hs/hail -
62
>>> /"success":true,"info":"Request successful: Selected group: Group 2.*/
63
>>>= 0
64

    
65
# Run some of the tests above, with exclusive storage enabled
66
./test/hs/hail $T/hail-alloc-drbd.json.excl-stor
67
>>> /"success":true,.*,"result":\["node2","node1"\]/
68
>>>= 0
69

    
70
./test/hs/hail $T/hail-reloc-drbd.json.excl-stor
71
>>> /"success":true,.*,"result":\["node1"\]/
72
>>>= 0
73

    
74
./test/hs/hail $T/hail-node-evac.json.excl-stor
75
>>> /"success":true,"info":"Request successful: 0 instances failed to move and 1 were moved successfully"/
76
>>>= 0
77

    
78
./test/hs/hail $T/hail-change-group.json.excl-stor
79
>>> /"success":true,"info":"Request successful: 0 instances failed to move and 1 were moved successfully"/
80
>>>= 0
81

    
82
./test/hs/hail $T/hail-alloc-twodisks.json.excl-stor
83
>>> /"success":true,.*,"result":\["node1"\]/
84
>>>= 0
85

    
86
./test/hs/hail $T/hail-alloc-invalid-twodisks.json.excl-stor
87
>>> /"success":false,.*FailDisk: 1"/
88
>>>= 0
89

    
90
# Same tests with exclusive storage enabled, but no spindles info in instances
91
# Operations involving relocation succed because policies are not checked
92
./test/hs/hail $T/hail-alloc-drbd.json.fail-excl-stor
93
>>> /"success":false,.*FailSpindles: 12"/
94
>>>= 0
95

    
96
./test/hs/hail $T/hail-reloc-drbd.json.fail-excl-stor
97
>>> /"success":true,.*,"result":\["node1"\]/
98
>>>= 0
99

    
100
./test/hs/hail $T/hail-node-evac.json.fail-excl-stor
101
>>> /"success":true,"info":"Request successful: 0 instances failed to move and 1 were moved successfully"/
102
>>>= 0
103

    
104
./test/hs/hail $T/hail-change-group.json.fail-excl-stor
105
>>> /"success":true,"info":"Request successful: 1 instances failed to move and 0 were moved successfully",.*FailSpindles: 2"/
106
>>>= 0
107

    
108
./test/hs/hail $T/hail-alloc-twodisks.json.fail-excl-stor
109
>>> /"success":false,.*FailSpindles: 1"/
110
>>>= 0
111

    
112
# check that hail can use the simu backend
113
./test/hs/hail --simu p,8,8T,16g,16 $TESTDATA_DIR/hail-alloc-drbd.json
114
>>> /"success":true,/
115
>>>= 0
116

    
117
# check that hail can use the text backend
118
./test/hs/hail -t $T/simu-rebal-merged.standard $TESTDATA_DIR/hail-alloc-drbd.json
119
>>> /"success":true,/
120
>>>= 0
121

    
122
# check that hail can use the simu backend
123
./test/hs/hail -t $T/simu-rebal-merged.standard $TESTDATA_DIR/hail-alloc-drbd.json
124
>>> /"success":true,/
125
>>>= 0
126

    
127
# check that hail pre/post saved state differs after allocation
128
./test/hs/hail -v -v -v -p $TESTDATA_DIR/hail-alloc-drbd.json -S $T/hail-alloc >/dev/null 2>&1 && ! diff -q $T/hail-alloc.pre-ialloc $T/hail-alloc.post-ialloc
129
>>> /Files .* and .* differ/
130
>>>= 0
131

    
132
# check that hail pre/post saved state differs after relocation
133
./test/hs/hail -v -v -v -p $TESTDATA_DIR/hail-reloc-drbd.json -S $T/hail-reloc >/dev/null 2>&1 && ! diff -q $T/hail-reloc.pre-ialloc $T/hail-reloc.post-ialloc
134
>>> /Files .* and .* differ/
135
>>>= 0
136

    
137
# evac tests
138
./test/hs/hail $T/hail-node-evac.json.primary-only
139
>>> /"success":true,"info":"Request successful: 0 instances failed to move and 1 were moved successfully"/
140
>>>= 0
141

    
142
./test/hs/hail $T/hail-node-evac.json.secondary-only
143
>>> /"success":true,"info":"Request successful: 0 instances failed to move and 1 were moved successfully"/
144
>>>= 0
145

    
146
./test/hs/hail $T/hail-node-evac.json.all
147
>>> /"success":true,"info":"Request successful: 0 instances failed to move and 1 were moved successfully"/
148
>>>= 0
149

    
150
# Check interaction between policies and spindles
151
./test/hs/hail $TESTDATA_DIR/hail-alloc-spindles.json
152
>>> /"success":true,"info":"Request successful: Selected group: group2,.*FailSpindles: 2,.*"result":\["node4"\]/
153
>>>= 0
154

    
155
./test/hs/hail $T/hail-alloc-spindles.json.excl-stor
156
>>> /"success":true,"info":"Request successful: Selected group: group1,.*FailSpindles: 2",.*"result":\["node2"\]/
157
>>>= 0