Statistics
| Branch: | Tag: | Revision:

root / htools / offline-test.sh @ 0c28bee1

History | View | Annotate | Download (3.1 kB)

1
#!/bin/bash
2

    
3
# Copyright (C) 2012 Google Inc.
4

    
5
# This program is free software; you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 2 of the License, or
8
# (at your option) any later version.
9

    
10
# This program is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
# General Public License for more details.
14

    
15
# You should have received a copy of the GNU General Public License
16
# along with this program; if not, write to the Free Software
17
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18
# 02110-1301, USA.
19

    
20
# This is an offline testing script for most/all of the htools
21
# programs, checking basic command line functionality.
22

    
23
set -e
24
set -o pipefail
25

    
26
. $(dirname $0)/cli-tests-defs.sh
27

    
28
echo Running offline htools tests
29

    
30
export T=`mktemp -d`
31
trap 'rm -rf $T' EXIT
32
trap 'echo FAIL to build test files' ERR
33
echo Using $T as temporary dir
34

    
35
echo -n Generating hspace simulation data for hinfo and hbal...
36
# this cluster spec should be fine
37
./test/hspace --simu p,4,8T,64g,16 -S $T/simu-onegroup \
38
  --disk-template drbd -l 8 -v -v -v >/dev/null 2>&1
39
echo OK
40

    
41
echo -n Generating hinfo and hbal test files for multi-group...
42
./test/hspace --simu p,4,8T,64g,16 --simu p,4,8T,64g,16 \
43
  -S $T/simu-twogroups --disk-template drbd -l 8 >/dev/null 2>&1
44
echo OK
45

    
46
echo -n Generating test files for rebalancing...
47
# we generate a cluster with two node groups, one with unallocable
48
# policy, then we change all nodes from this group to the allocable
49
# one, and we check for rebalancing
50
FROOT="$T/simu-rebal-orig"
51
./test/hspace --simu u,4,8T,64g,16 --simu p,4,8T,64g,16 \
52
  -S $FROOT --disk-template drbd -l 8 >/dev/null 2>&1
53
for suffix in standard tiered; do
54
  RELOC="$T/simu-rebal-merged.$suffix"
55
  # this relocates the nodes
56
  sed -re 's/^(node-.*|fake-uuid-)-02(|.*)/\1-01\2/' \
57
    < $FROOT.$suffix > $RELOC
58
done
59
export BACKEND_BAL_STD="-t$T/simu-rebal-merged.standard"
60
export BACKEND_BAL_TIER="-t$T/simu-rebal-merged.tiered"
61
echo OK
62

    
63
# For various tests
64
export BACKEND_DYNU="-t $T/simu-onegroup.standard"
65
export BACKEND_EXCL="-t $T/simu-onegroup.standard"
66

    
67
echo -n Generating data files for IAllocator checks...
68
for evac_mode in primary-only secondary-only all; do
69
  sed -e 's/"evac_mode": "all"/"evac_mode": "'${evac_mode}'"/' \
70
    < $TESTDATA_DIR/hail-node-evac.json \
71
    > $T/hail-node-evac.json.$evac_mode
72
done
73
echo OK
74

    
75
echo -n Checking file-based RAPI...
76
mkdir -p $T/hscan
77
export RAPI_URL="file://$TESTDATA_DIR/rapi"
78
./test/hscan -d $T/hscan/ -p -v -v $RAPI_URL >/dev/null 2>&1
79
# check that we file parsing is correct, i.e. hscan saves correct text
80
# files, and is idempotent (rapi+text == rapi); more is tested in
81
# shelltest later
82
RAPI_TXT="$(ls $T/hscan/*.data|head -n1)"
83
./test/hinfo -p --print-instances -m $RAPI_URL > $T/hscan/direct.hinfo 2>&1
84
./test/hinfo -p --print-instances -t $RAPI_TXT > $T/hscan/fromtext.hinfo 2>&1
85
echo OK
86

    
87
echo Running shelltest...
88

    
89
shelltest $SHELLTESTARGS \
90
  ${TOP_SRCDIR:-.}/test/htools-*.test \
91
  -- --hide-successes
92

    
93
echo All OK