root / test / hs / offline-test.sh @ 45460c20
History | View | Annotate | Download (4.5 kB)
1 | 42089b55 | Iustin Pop | #!/bin/bash |
---|---|---|---|
2 | 42089b55 | Iustin Pop | |
3 | 42089b55 | Iustin Pop | # Copyright (C) 2012 Google Inc. |
4 | fe42a791 | Klaus Aehlig | # All rights reserved. |
5 | fe42a791 | Klaus Aehlig | # |
6 | fe42a791 | Klaus Aehlig | # Redistribution and use in source and binary forms, with or without |
7 | fe42a791 | Klaus Aehlig | # modification, are permitted provided that the following conditions are |
8 | fe42a791 | Klaus Aehlig | # met: |
9 | fe42a791 | Klaus Aehlig | # |
10 | fe42a791 | Klaus Aehlig | # 1. Redistributions of source code must retain the above copyright notice, |
11 | fe42a791 | Klaus Aehlig | # this list of conditions and the following disclaimer. |
12 | fe42a791 | Klaus Aehlig | # |
13 | fe42a791 | Klaus Aehlig | # 2. Redistributions in binary form must reproduce the above copyright |
14 | fe42a791 | Klaus Aehlig | # notice, this list of conditions and the following disclaimer in the |
15 | fe42a791 | Klaus Aehlig | # documentation and/or other materials provided with the distribution. |
16 | fe42a791 | Klaus Aehlig | # |
17 | fe42a791 | Klaus Aehlig | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS |
18 | fe42a791 | Klaus Aehlig | # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
19 | fe42a791 | Klaus Aehlig | # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
20 | fe42a791 | Klaus Aehlig | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR |
21 | fe42a791 | Klaus Aehlig | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
22 | fe42a791 | Klaus Aehlig | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
23 | fe42a791 | Klaus Aehlig | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
24 | fe42a791 | Klaus Aehlig | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
25 | fe42a791 | Klaus Aehlig | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
26 | fe42a791 | Klaus Aehlig | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
27 | fe42a791 | Klaus Aehlig | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 | 42089b55 | Iustin Pop | |
29 | 42089b55 | Iustin Pop | # This is an offline testing script for most/all of the htools |
30 | 42089b55 | Iustin Pop | # programs, checking basic command line functionality. |
31 | 42089b55 | Iustin Pop | |
32 | 5f7d4181 | Jose A. Lopes | # Optional argument that specifies the test files to run. If not |
33 | 5f7d4181 | Jose A. Lopes | # specified, then all tests are run. |
34 | 5f7d4181 | Jose A. Lopes | # |
35 | 5f7d4181 | Jose A. Lopes | # For example, a value of 'balancing' runs the file |
36 | 5f7d4181 | Jose A. Lopes | # 'shelltests/htools-balancing.test'. Multiple files can be specified |
37 | 5f7d4181 | Jose A. Lopes | # using shell notation, for example, '{balancing,basic}'. |
38 | 5f7d4181 | Jose A. Lopes | TESTS=${1:-*} |
39 | 5f7d4181 | Jose A. Lopes | |
40 | 42089b55 | Iustin Pop | set -e |
41 | 30084381 | Iustin Pop | set -o pipefail |
42 | 42089b55 | Iustin Pop | |
43 | 42089b55 | Iustin Pop | . $(dirname $0)/cli-tests-defs.sh |
44 | 42089b55 | Iustin Pop | |
45 | 53d4cdf1 | Iustin Pop | echo Running offline htools tests |
46 | 53d4cdf1 | Iustin Pop | |
47 | 53d4cdf1 | Iustin Pop | export T=`mktemp -d` |
48 | 3e7220e4 | Iustin Pop | trap 'rm -rf $T' EXIT |
49 | 53d4cdf1 | Iustin Pop | trap 'echo FAIL to build test files' ERR |
50 | 3e7220e4 | Iustin Pop | echo Using $T as temporary dir |
51 | 3e7220e4 | Iustin Pop | |
52 | 53d4cdf1 | Iustin Pop | echo -n Generating hspace simulation data for hinfo and hbal... |
53 | 3e7220e4 | Iustin Pop | # this cluster spec should be fine |
54 | 83846468 | Iustin Pop | ./test/hs/hspace --simu p,4,8T,64g,16 -S $T/simu-onegroup \ |
55 | 3e7220e4 | Iustin Pop | --disk-template drbd -l 8 -v -v -v >/dev/null 2>&1 |
56 | 3e7220e4 | Iustin Pop | echo OK |
57 | 3e7220e4 | Iustin Pop | |
58 | 53d4cdf1 | Iustin Pop | echo -n Generating hinfo and hbal test files for multi-group... |
59 | 83846468 | Iustin Pop | ./test/hs/hspace --simu p,4,8T,64g,16 --simu p,4,8T,64g,16 \ |
60 | 3e7220e4 | Iustin Pop | -S $T/simu-twogroups --disk-template drbd -l 8 >/dev/null 2>&1 |
61 | 3e7220e4 | Iustin Pop | echo OK |
62 | 42089b55 | Iustin Pop | |
63 | 53d4cdf1 | Iustin Pop | echo -n Generating test files for rebalancing... |
64 | 16197d69 | Iustin Pop | # we generate a cluster with two node groups, one with unallocable |
65 | 16197d69 | Iustin Pop | # policy, then we change all nodes from this group to the allocable |
66 | 16197d69 | Iustin Pop | # one, and we check for rebalancing |
67 | 16197d69 | Iustin Pop | FROOT="$T/simu-rebal-orig" |
68 | 83846468 | Iustin Pop | ./test/hs/hspace --simu u,4,8T,64g,16 --simu p,4,8T,64g,16 \ |
69 | 16197d69 | Iustin Pop | -S $FROOT --disk-template drbd -l 8 >/dev/null 2>&1 |
70 | 16197d69 | Iustin Pop | for suffix in standard tiered; do |
71 | 16197d69 | Iustin Pop | RELOC="$T/simu-rebal-merged.$suffix" |
72 | 16197d69 | Iustin Pop | # this relocates the nodes |
73 | 16197d69 | Iustin Pop | sed -re 's/^(node-.*|fake-uuid-)-02(|.*)/\1-01\2/' \ |
74 | 16197d69 | Iustin Pop | < $FROOT.$suffix > $RELOC |
75 | 16197d69 | Iustin Pop | done |
76 | 53d4cdf1 | Iustin Pop | export BACKEND_BAL_STD="-t$T/simu-rebal-merged.standard" |
77 | 53d4cdf1 | Iustin Pop | export BACKEND_BAL_TIER="-t$T/simu-rebal-merged.tiered" |
78 | 16197d69 | Iustin Pop | echo OK |
79 | 16197d69 | Iustin Pop | |
80 | 53d4cdf1 | Iustin Pop | # For various tests |
81 | 53d4cdf1 | Iustin Pop | export BACKEND_DYNU="-t $T/simu-onegroup.standard" |
82 | 53d4cdf1 | Iustin Pop | export BACKEND_EXCL="-t $T/simu-onegroup.standard" |
83 | 6bbd76d2 | Iustin Pop | |
84 | 53d4cdf1 | Iustin Pop | echo -n Generating data files for IAllocator checks... |
85 | 6bbd76d2 | Iustin Pop | for evac_mode in primary-only secondary-only all; do |
86 | 6bbd76d2 | Iustin Pop | sed -e 's/"evac_mode": "all"/"evac_mode": "'${evac_mode}'"/' \ |
87 | d7976f54 | Bernardo Dal Seno | -e 's/"spindles": [0-9]\+,//' \ |
88 | 6bbd76d2 | Iustin Pop | < $TESTDATA_DIR/hail-node-evac.json \ |
89 | 6bbd76d2 | Iustin Pop | > $T/hail-node-evac.json.$evac_mode |
90 | 6bbd76d2 | Iustin Pop | done |
91 | d7976f54 | Bernardo Dal Seno | for bf in hail-alloc-drbd hail-alloc-invalid-twodisks hail-alloc-twodisks \ |
92 | d7976f54 | Bernardo Dal Seno | hail-change-group hail-node-evac hail-reloc-drbd hail-alloc-spindles; do |
93 | d7976f54 | Bernardo Dal Seno | f=$bf.json |
94 | d7976f54 | Bernardo Dal Seno | sed -e 's/"exclusive_storage": false/"exclusive_storage": true/' \ |
95 | d7976f54 | Bernardo Dal Seno | < $TESTDATA_DIR/$f > $T/$f.excl-stor |
96 | d7976f54 | Bernardo Dal Seno | sed -e 's/"exclusive_storage": false/"exclusive_storage": true/' \ |
97 | d7976f54 | Bernardo Dal Seno | -e 's/"spindles": [0-9]\+,//' \ |
98 | d7976f54 | Bernardo Dal Seno | < $TESTDATA_DIR/$f > $T/$f.fail-excl-stor |
99 | d7976f54 | Bernardo Dal Seno | done |
100 | 6bbd76d2 | Iustin Pop | echo OK |
101 | 6bbd76d2 | Iustin Pop | |
102 | 53d4cdf1 | Iustin Pop | echo -n Checking file-based RAPI... |
103 | 55ffacfa | Iustin Pop | mkdir -p $T/hscan |
104 | 53d4cdf1 | Iustin Pop | export RAPI_URL="file://$TESTDATA_DIR/rapi" |
105 | 83846468 | Iustin Pop | ./test/hs/hscan -d $T/hscan/ -p -v -v $RAPI_URL >/dev/null 2>&1 |
106 | 55ffacfa | Iustin Pop | # check that we file parsing is correct, i.e. hscan saves correct text |
107 | 53d4cdf1 | Iustin Pop | # files, and is idempotent (rapi+text == rapi); more is tested in |
108 | 53d4cdf1 | Iustin Pop | # shelltest later |
109 | 53d4cdf1 | Iustin Pop | RAPI_TXT="$(ls $T/hscan/*.data|head -n1)" |
110 | 83846468 | Iustin Pop | ./test/hs/hinfo -p --print-instances -m $RAPI_URL > $T/hscan/direct.hinfo 2>&1 |
111 | 83846468 | Iustin Pop | ./test/hs/hinfo -p --print-instances -t $RAPI_TXT > $T/hscan/fromtext.hinfo 2>&1 |
112 | 55ffacfa | Iustin Pop | echo OK |
113 | 55ffacfa | Iustin Pop | |
114 | 53d4cdf1 | Iustin Pop | echo Running shelltest... |
115 | 53d4cdf1 | Iustin Pop | |
116 | 30f2802f | Iustin Pop | shelltest $SHELLTESTARGS \ |
117 | fe42a791 | Klaus Aehlig | ${TOP_SRCDIR:-.}/test/hs/shelltests/htools-$TESTS.test |