Revision 3e7220e4 htools/offline-test.sh

b/htools/offline-test.sh
24 24

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

  
27
echo -n "Checking command line basic options "
27
T=`mktemp -d`
28
trap 'rm -rf $T' EXIT
29
trap 'echo FAIL' ERR
30
echo Using $T as temporary dir
31

  
32
echo Checking command line basic options
28 33
for prog in $ALL_ROLES; do
29
  echo -n "."
30 34
  $prog --version >/dev/null
31 35
  $prog --help >/dev/null
32 36
  ! $prog --no-such-option 2>/dev/null
33 37
done
34
echo
38
echo OK
39

  
40
echo Checking missing backend failure
41
for prog in hspace hinfo hbal; do
42
  ! $prog 2>/dev/null
43
done
44
echo OK
45

  
46
echo Checking hail missing input file
47
! hail 2>/dev/null
48
echo OK
49

  
50
echo Checking extra arguments
51
for prog in hspace hbal hinfo; do
52
  ! $prog unexpected-argument 2>&1 | \
53
    grep -q "Error: this program doesn't take any arguments"
54
done
55
echo OK
56

  
57
echo Checking failure on multiple backends
58
(! hbal -t /dev/null -m localhost 2>&1 ) | \
59
  grep -q "Error: Only one of the rapi, luxi, and data files options should be given."
60
echo OK
61

  
62
echo Checking hspace machine-readable mode
63
hspace --simu p,4,8T,64g,16 --machine-readable \
64
  --disk-template drbd -l 8 >$T/capacity
65
( . $T/capacity && test "$HTS_OK" = "1" )
66
echo OK
67

  
68
echo Checking hspace simulation to hinfo to hbal
69
# this cluster spec should be fine
70
hspace --simu p,4,8T,64g,16 -S $T/simu-onegroup \
71
  --disk-template drbd -l 8 -v -v -v >/dev/null 2>&1
72
# results in .tiered and .standard
73
for suffix in standard tiered; do
74
  BACKEND="-t$T/simu-onegroup.$suffix"
75
  hinfo -v -v -p --print-instances $BACKEND >/dev/null 2>&1
76
  hbal  -v -v -p --print-instances $BACKEND >/dev/null 2>&1
77
  # hbal should not be able to balance
78
  hbal $BACKEND | grep -qE "(Nothing to do, exiting|No solution found)"
79
done
80
echo OK
81

  
82
echo Checking hinfo and hbal on multi-nodegroup
83
hspace --simu p,4,8T,64g,16 --simu p,4,8T,64g,16 \
84
  -S $T/simu-twogroups --disk-template drbd -l 8 >/dev/null 2>&1
85
# results in .tiered and .standard
86
for suffix in standard tiered; do
87
  BACKEND="-t$T/simu-twogroups.$suffix"
88
  hinfo -v -v -p --print-instances $BACKEND >/dev/null 2>&1
89
  ! hbal $BACKEND >/dev/null 2>&1
90
  # hbal should not be able to balance
91
  ! hbal $BACKEND 2>&1 | grep -q "Found multiple node groups"
92
  # but hbal should be able to balance one node group
93
  hbal $BACKEND -G group-01 >/dev/null
94
  # and it should not find an invalid group
95
  ! hbal $BACKEND -G no-such-group >/dev/null 2>&1
96
done
97
echo OK
35 98

  
36 99
echo All OK

Also available in: Unified diff