1 # test that on invalid files it can't parse the request
2 ./test/hs/hail /dev/null
6 # another invalid example
7 echo '[]' | ./test/hs/hail -
8 >>>2 /Unable to read JSObject/
12 echo '{}' | ./test/hs/hail -
13 >>>2 /key 'request' not found/
16 echo '{"request": 0}' | ./test/hs/hail -
20 ./test/hs/hail $TESTDATA_DIR/hail-invalid-reloc.json
21 >>>2 /key 'name': Unable to read String/
24 # and now start the real tests
25 ./test/hs/hail $TESTDATA_DIR/hail-alloc-drbd.json
26 >>> /"success":true,.*,"result":\["node2","node1"\]/
29 ./test/hs/hail $TESTDATA_DIR/hail-reloc-drbd.json
30 >>> /"success":true,.*,"result":\["node1"\]/
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"/
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"/
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"\]/
46 ./test/hs/hail $TESTDATA_DIR/hail-alloc-invalid-twodisks.json
47 >>> /"success":false,.*FailDisk: 1/
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.*/
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,/
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.*/
65 # check that hail can use the simu backend
66 ./test/hs/hail --simu p,8,8T,16g,16 $TESTDATA_DIR/hail-alloc-drbd.json
70 # check that hail can use the text backend
71 ./test/hs/hail -t $T/simu-rebal-merged.standard $TESTDATA_DIR/hail-alloc-drbd.json
75 # check that hail can use the simu backend
76 ./test/hs/hail -t $T/simu-rebal-merged.standard $TESTDATA_DIR/hail-alloc-drbd.json
80 # check that hail pre/post saved state differs after allocation
81 ./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
82 >>> /Files .* and .* differ/
85 # check that hail pre/post saved state differs after relocation
86 ./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
87 >>> /Files .* and .* differ/
91 ./test/hs/hail $T/hail-node-evac.json.primary-only
92 >>> /"success":true,"info":"Request successful: 0 instances failed to move and 1 were moved successfully"/
95 ./test/hs/hail $T/hail-node-evac.json.secondary-only
96 >>> /"success":true,"info":"Request successful: 0 instances failed to move and 1 were moved successfully"/
99 ./test/hs/hail $T/hail-node-evac.json.all
100 >>> /"success":true,"info":"Request successful: 0 instances failed to move and 1 were moved successfully"/