| Branch: | Tag: | Revision:

root / test / hs / @ 5275a77f

History | View | Annotate | Download (3.9 kB)

1 42089b55 Iustin Pop
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
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 5f7d4181 Jose A. Lopes
# Optional argument that specifies the test files to run. If not
24 5f7d4181 Jose A. Lopes
# specified, then all tests are run.
25 5f7d4181 Jose A. Lopes
26 5f7d4181 Jose A. Lopes
# For example, a value of 'balancing' runs the file
27 5f7d4181 Jose A. Lopes
# 'shelltests/htools-balancing.test'.  Multiple files can be specified
28 5f7d4181 Jose A. Lopes
# using shell notation, for example, '{balancing,basic}'.
29 5f7d4181 Jose A. Lopes
30 5f7d4181 Jose A. Lopes
31 42089b55 Iustin Pop
set -e
32 30084381 Iustin Pop
set -o pipefail
33 42089b55 Iustin Pop
34 42089b55 Iustin Pop
. $(dirname $0)/
35 42089b55 Iustin Pop
36 53d4cdf1 Iustin Pop
echo Running offline htools tests
37 53d4cdf1 Iustin Pop
38 53d4cdf1 Iustin Pop
export T=`mktemp -d`
39 3e7220e4 Iustin Pop
trap 'rm -rf $T' EXIT
40 53d4cdf1 Iustin Pop
trap 'echo FAIL to build test files' ERR
41 3e7220e4 Iustin Pop
echo Using $T as temporary dir
42 3e7220e4 Iustin Pop
43 53d4cdf1 Iustin Pop
echo -n Generating hspace simulation data for hinfo and hbal...
44 3e7220e4 Iustin Pop
# this cluster spec should be fine
45 83846468 Iustin Pop
./test/hs/hspace --simu p,4,8T,64g,16 -S $T/simu-onegroup \
46 3e7220e4 Iustin Pop
  --disk-template drbd -l 8 -v -v -v >/dev/null 2>&1
47 3e7220e4 Iustin Pop
echo OK
48 3e7220e4 Iustin Pop
49 53d4cdf1 Iustin Pop
echo -n Generating hinfo and hbal test files for multi-group...
50 83846468 Iustin Pop
./test/hs/hspace --simu p,4,8T,64g,16 --simu p,4,8T,64g,16 \
51 3e7220e4 Iustin Pop
  -S $T/simu-twogroups --disk-template drbd -l 8 >/dev/null 2>&1
52 3e7220e4 Iustin Pop
echo OK
53 42089b55 Iustin Pop
54 53d4cdf1 Iustin Pop
echo -n Generating test files for rebalancing...
55 16197d69 Iustin Pop
# we generate a cluster with two node groups, one with unallocable
56 16197d69 Iustin Pop
# policy, then we change all nodes from this group to the allocable
57 16197d69 Iustin Pop
# one, and we check for rebalancing
58 16197d69 Iustin Pop
59 83846468 Iustin Pop
./test/hs/hspace --simu u,4,8T,64g,16 --simu p,4,8T,64g,16 \
60 16197d69 Iustin Pop
  -S $FROOT --disk-template drbd -l 8 >/dev/null 2>&1
61 16197d69 Iustin Pop
for suffix in standard tiered; do
62 16197d69 Iustin Pop
63 16197d69 Iustin Pop
  # this relocates the nodes
64 16197d69 Iustin Pop
  sed -re 's/^(node-.*|fake-uuid-)-02(|.*)/\1-01\2/' \
65 16197d69 Iustin Pop
    < $FROOT.$suffix > $RELOC
66 16197d69 Iustin Pop
67 53d4cdf1 Iustin Pop
export BACKEND_BAL_STD="-t$T/simu-rebal-merged.standard"
68 53d4cdf1 Iustin Pop
export BACKEND_BAL_TIER="-t$T/simu-rebal-merged.tiered"
69 16197d69 Iustin Pop
echo OK
70 16197d69 Iustin Pop
71 53d4cdf1 Iustin Pop
# For various tests
72 53d4cdf1 Iustin Pop
export BACKEND_DYNU="-t $T/simu-onegroup.standard"
73 53d4cdf1 Iustin Pop
export BACKEND_EXCL="-t $T/simu-onegroup.standard"
74 6bbd76d2 Iustin Pop
75 53d4cdf1 Iustin Pop
echo -n Generating data files for IAllocator checks...
76 6bbd76d2 Iustin Pop
for evac_mode in primary-only secondary-only all; do
77 6bbd76d2 Iustin Pop
  sed -e 's/"evac_mode": "all"/"evac_mode": "'${evac_mode}'"/' \
78 d7976f54 Bernardo Dal Seno
    -e 's/"spindles": [0-9]\+,//' \
79 6bbd76d2 Iustin Pop
    < $TESTDATA_DIR/hail-node-evac.json \
80 6bbd76d2 Iustin Pop
    > $T/hail-node-evac.json.$evac_mode
81 6bbd76d2 Iustin Pop
82 d7976f54 Bernardo Dal Seno
for bf in hail-alloc-drbd hail-alloc-invalid-twodisks hail-alloc-twodisks \
83 d7976f54 Bernardo Dal Seno
  hail-change-group hail-node-evac hail-reloc-drbd hail-alloc-spindles; do
84 d7976f54 Bernardo Dal Seno
85 d7976f54 Bernardo Dal Seno
  sed -e 's/"exclusive_storage": false/"exclusive_storage": true/' \
86 d7976f54 Bernardo Dal Seno
    < $TESTDATA_DIR/$f > $T/$f.excl-stor
87 d7976f54 Bernardo Dal Seno
  sed -e 's/"exclusive_storage": false/"exclusive_storage": true/' \
88 d7976f54 Bernardo Dal Seno
    -e 's/"spindles": [0-9]\+,//' \
89 d7976f54 Bernardo Dal Seno
    < $TESTDATA_DIR/$f > $T/$
90 d7976f54 Bernardo Dal Seno
91 6bbd76d2 Iustin Pop
echo OK
92 6bbd76d2 Iustin Pop
93 53d4cdf1 Iustin Pop
echo -n Checking file-based RAPI...
94 55ffacfa Iustin Pop
mkdir -p $T/hscan
95 53d4cdf1 Iustin Pop
export RAPI_URL="file://$TESTDATA_DIR/rapi"
96 83846468 Iustin Pop
./test/hs/hscan -d $T/hscan/ -p -v -v $RAPI_URL >/dev/null 2>&1
97 55ffacfa Iustin Pop
# check that we file parsing is correct, i.e. hscan saves correct text
98 53d4cdf1 Iustin Pop
# files, and is idempotent (rapi+text == rapi); more is tested in
99 53d4cdf1 Iustin Pop
# shelltest later
100 53d4cdf1 Iustin Pop
RAPI_TXT="$(ls $T/hscan/*.data|head -n1)"
101 83846468 Iustin Pop
./test/hs/hinfo -p --print-instances -m $RAPI_URL > $T/hscan/direct.hinfo 2>&1
102 83846468 Iustin Pop
./test/hs/hinfo -p --print-instances -t $RAPI_TXT > $T/hscan/fromtext.hinfo 2>&1
103 55ffacfa Iustin Pop
echo OK
104 55ffacfa Iustin Pop
105 53d4cdf1 Iustin Pop
echo Running shelltest...
106 53d4cdf1 Iustin Pop
107 30f2802f Iustin Pop
shelltest $SHELLTESTARGS \
108 5f7d4181 Jose A. Lopes