root / test / hs / offline-test.sh @ a93e5814
History | View | Annotate | Download (3.6 kB)
1 | 42089b55 | Iustin Pop | #!/bin/bash |
---|---|---|---|
2 | 42089b55 | Iustin Pop | |
3 | 42089b55 | Iustin Pop | # Copyright (C) 2012 Google Inc. |
4 | 42089b55 | Iustin Pop | |
5 | 42089b55 | Iustin Pop | # This program is free software; you can redistribute it and/or modify |
6 | 42089b55 | Iustin Pop | # it under the terms of the GNU General Public License as published by |
7 | 42089b55 | Iustin Pop | # the Free Software Foundation; either version 2 of the License, or |
8 | 42089b55 | Iustin Pop | # (at your option) any later version. |
9 | 42089b55 | Iustin Pop | |
10 | 42089b55 | Iustin Pop | # This program is distributed in the hope that it will be useful, but |
11 | 42089b55 | Iustin Pop | # WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | 42089b55 | Iustin Pop | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | 42089b55 | Iustin Pop | # General Public License for more details. |
14 | 42089b55 | Iustin Pop | |
15 | 42089b55 | Iustin Pop | # You should have received a copy of the GNU General Public License |
16 | 42089b55 | Iustin Pop | # along with this program; if not, write to the Free Software |
17 | 42089b55 | Iustin Pop | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | 42089b55 | Iustin Pop | # 02110-1301, USA. |
19 | 42089b55 | Iustin Pop | |
20 | 42089b55 | Iustin Pop | # This is an offline testing script for most/all of the htools |
21 | 42089b55 | Iustin Pop | # programs, checking basic command line functionality. |
22 | 42089b55 | Iustin Pop | |
23 | 42089b55 | Iustin Pop | set -e |
24 | 30084381 | Iustin Pop | set -o pipefail |
25 | 42089b55 | Iustin Pop | |
26 | 42089b55 | Iustin Pop | . $(dirname $0)/cli-tests-defs.sh |
27 | 42089b55 | Iustin Pop | |
28 | 53d4cdf1 | Iustin Pop | echo Running offline htools tests |
29 | 53d4cdf1 | Iustin Pop | |
30 | 53d4cdf1 | Iustin Pop | export T=`mktemp -d` |
31 | 3e7220e4 | Iustin Pop | trap 'rm -rf $T' EXIT |
32 | 53d4cdf1 | Iustin Pop | trap 'echo FAIL to build test files' ERR |
33 | 3e7220e4 | Iustin Pop | echo Using $T as temporary dir |
34 | 3e7220e4 | Iustin Pop | |
35 | 53d4cdf1 | Iustin Pop | echo -n Generating hspace simulation data for hinfo and hbal... |
36 | 3e7220e4 | Iustin Pop | # this cluster spec should be fine |
37 | 83846468 | Iustin Pop | ./test/hs/hspace --simu p,4,8T,64g,16 -S $T/simu-onegroup \ |
38 | 3e7220e4 | Iustin Pop | --disk-template drbd -l 8 -v -v -v >/dev/null 2>&1 |
39 | 3e7220e4 | Iustin Pop | echo OK |
40 | 3e7220e4 | Iustin Pop | |
41 | 53d4cdf1 | Iustin Pop | echo -n Generating hinfo and hbal test files for multi-group... |
42 | 83846468 | Iustin Pop | ./test/hs/hspace --simu p,4,8T,64g,16 --simu p,4,8T,64g,16 \ |
43 | 3e7220e4 | Iustin Pop | -S $T/simu-twogroups --disk-template drbd -l 8 >/dev/null 2>&1 |
44 | 3e7220e4 | Iustin Pop | echo OK |
45 | 42089b55 | Iustin Pop | |
46 | 53d4cdf1 | Iustin Pop | echo -n Generating test files for rebalancing... |
47 | 16197d69 | Iustin Pop | # we generate a cluster with two node groups, one with unallocable |
48 | 16197d69 | Iustin Pop | # policy, then we change all nodes from this group to the allocable |
49 | 16197d69 | Iustin Pop | # one, and we check for rebalancing |
50 | 16197d69 | Iustin Pop | FROOT="$T/simu-rebal-orig" |
51 | 83846468 | Iustin Pop | ./test/hs/hspace --simu u,4,8T,64g,16 --simu p,4,8T,64g,16 \ |
52 | 16197d69 | Iustin Pop | -S $FROOT --disk-template drbd -l 8 >/dev/null 2>&1 |
53 | 16197d69 | Iustin Pop | for suffix in standard tiered; do |
54 | 16197d69 | Iustin Pop | RELOC="$T/simu-rebal-merged.$suffix" |
55 | 16197d69 | Iustin Pop | # this relocates the nodes |
56 | 16197d69 | Iustin Pop | sed -re 's/^(node-.*|fake-uuid-)-02(|.*)/\1-01\2/' \ |
57 | 16197d69 | Iustin Pop | < $FROOT.$suffix > $RELOC |
58 | 16197d69 | Iustin Pop | done |
59 | 53d4cdf1 | Iustin Pop | export BACKEND_BAL_STD="-t$T/simu-rebal-merged.standard" |
60 | 53d4cdf1 | Iustin Pop | export BACKEND_BAL_TIER="-t$T/simu-rebal-merged.tiered" |
61 | 16197d69 | Iustin Pop | echo OK |
62 | 16197d69 | Iustin Pop | |
63 | 53d4cdf1 | Iustin Pop | # For various tests |
64 | 53d4cdf1 | Iustin Pop | export BACKEND_DYNU="-t $T/simu-onegroup.standard" |
65 | 53d4cdf1 | Iustin Pop | export BACKEND_EXCL="-t $T/simu-onegroup.standard" |
66 | 6bbd76d2 | Iustin Pop | |
67 | 53d4cdf1 | Iustin Pop | echo -n Generating data files for IAllocator checks... |
68 | 6bbd76d2 | Iustin Pop | for evac_mode in primary-only secondary-only all; do |
69 | 6bbd76d2 | Iustin Pop | sed -e 's/"evac_mode": "all"/"evac_mode": "'${evac_mode}'"/' \ |
70 | d7976f54 | Bernardo Dal Seno | -e 's/"spindles": [0-9]\+,//' \ |
71 | 6bbd76d2 | Iustin Pop | < $TESTDATA_DIR/hail-node-evac.json \ |
72 | 6bbd76d2 | Iustin Pop | > $T/hail-node-evac.json.$evac_mode |
73 | 6bbd76d2 | Iustin Pop | done |
74 | d7976f54 | Bernardo Dal Seno | for bf in hail-alloc-drbd hail-alloc-invalid-twodisks hail-alloc-twodisks \ |
75 | d7976f54 | Bernardo Dal Seno | hail-change-group hail-node-evac hail-reloc-drbd hail-alloc-spindles; do |
76 | d7976f54 | Bernardo Dal Seno | f=$bf.json |
77 | d7976f54 | Bernardo Dal Seno | sed -e 's/"exclusive_storage": false/"exclusive_storage": true/' \ |
78 | d7976f54 | Bernardo Dal Seno | < $TESTDATA_DIR/$f > $T/$f.excl-stor |
79 | d7976f54 | Bernardo Dal Seno | sed -e 's/"exclusive_storage": false/"exclusive_storage": true/' \ |
80 | d7976f54 | Bernardo Dal Seno | -e 's/"spindles": [0-9]\+,//' \ |
81 | d7976f54 | Bernardo Dal Seno | < $TESTDATA_DIR/$f > $T/$f.fail-excl-stor |
82 | d7976f54 | Bernardo Dal Seno | done |
83 | 6bbd76d2 | Iustin Pop | echo OK |
84 | 6bbd76d2 | Iustin Pop | |
85 | 53d4cdf1 | Iustin Pop | echo -n Checking file-based RAPI... |
86 | 55ffacfa | Iustin Pop | mkdir -p $T/hscan |
87 | 53d4cdf1 | Iustin Pop | export RAPI_URL="file://$TESTDATA_DIR/rapi" |
88 | 83846468 | Iustin Pop | ./test/hs/hscan -d $T/hscan/ -p -v -v $RAPI_URL >/dev/null 2>&1 |
89 | 55ffacfa | Iustin Pop | # check that we file parsing is correct, i.e. hscan saves correct text |
90 | 53d4cdf1 | Iustin Pop | # files, and is idempotent (rapi+text == rapi); more is tested in |
91 | 53d4cdf1 | Iustin Pop | # shelltest later |
92 | 53d4cdf1 | Iustin Pop | RAPI_TXT="$(ls $T/hscan/*.data|head -n1)" |
93 | 83846468 | Iustin Pop | ./test/hs/hinfo -p --print-instances -m $RAPI_URL > $T/hscan/direct.hinfo 2>&1 |
94 | 83846468 | Iustin Pop | ./test/hs/hinfo -p --print-instances -t $RAPI_TXT > $T/hscan/fromtext.hinfo 2>&1 |
95 | 55ffacfa | Iustin Pop | echo OK |
96 | 55ffacfa | Iustin Pop | |
97 | 53d4cdf1 | Iustin Pop | echo Running shelltest... |
98 | 53d4cdf1 | Iustin Pop | |
99 | 30f2802f | Iustin Pop | shelltest $SHELLTESTARGS \ |
100 | 83846468 | Iustin Pop | ${TOP_SRCDIR:-.}/test/hs/shelltests/htools-*.test \ |
101 | 30f2802f | Iustin Pop | -- --hide-successes |
102 | 53d4cdf1 | Iustin Pop | |
103 | 42089b55 | Iustin Pop | echo All OK |