From b880f1d1164e06837ae993d6538a3f7c5a636683 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Wed, 21 Jul 2010 20:27:09 -0400
Subject: [PATCH] Extend the live-test
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The (recently-enabled) live test coverage stats found a few low-hanging
fruits in the tests we do…
---
 live-test.sh | 61 +++++++++++++++++++++++++++++++++++++---------------
 1 file changed, 44 insertions(+), 17 deletions(-)

diff --git a/live-test.sh b/live-test.sh
index b8dcf7772..2fdb772d4 100755
--- a/live-test.sh
+++ b/live-test.sh
@@ -34,27 +34,54 @@ T=`mktemp -d`
 trap 'rm -rf $T' EXIT
 echo Using $T as temporary dir
 
-echo Testing hscan
-./hscan -d$T $RAPI
+echo Checking command line
+for prog in hscan hbal hail hspace; do
+    ./$prog --version
+    ./$prog --help
+done
+
+echo Testing hscan/rapi
+./hscan -d$T $RAPI -p
+echo Testing hscan/luxi
+./hscan -d$T -L$LUXI -p
+echo Comparing hscan results...
+diff -u $T/$RAPI.data $T/LOCAL.data
 
 echo Testing hbal/luxi
-./hbal -L$LUXI
+./hbal -L$LUXI -p --print-instances -C$T/hbal-luxi-cmds.sh
+bash -n $T/hbal-luxi-cmds.sh
 echo Testing hbal/rapi
-./hbal -m$RAPI
+./hbal -m$RAPI -p --print-instances -C$T/hbal-rapi-cmds.sh
+bash -n $T/hbal-rapi-cmds.sh
 echo Testing hbal/text
-./hbal -t$T/$RAPI.data
+./hbal -t$T/$RAPI.data -p --print-instances -C$T/hbal-text-cmds.sh
+bash -n $T/hbal-text-cmds.sh
+
+echo Testing hbal/text with evacuation mode
+./hbal -t$T/$RAPI.data -E
+echo Testing hbal/text with offline node mode
+FN=$(head -n1 $T/$RAPI.data|cut -d \| -f1)
+./hbal -t$T/$RAPI.data -O$FN
 
 echo Getting data files for hail
 IR=`$CLUSTER head -n1 /var/lib/ganeti/ssconf_instance_list`
-$CLUSTER gnt-debug allocator --dir in --mode allocate --mem 128m \
-    --disks 128m -t drbd -o no_such_os no_such_instance \
-    > $T/h-alloc.json
-$CLUSTER gnt-debug allocator --dir in --mode relocate --mem 128m \
-    --disks 128m -t drbd -o no_such_os $IR > $T/h-reloc.json
-echo Testing hail/allocate
-./hail $T/h-alloc.json
-echo Testing hail/relocate
+for dtemplate in plain drbd; do
+  $CLUSTER gnt-debug allocator --dir in --mode allocate --mem 128m \
+      --disks 128m -t $dtemplate -o no_such_os no_such_instance \
+      > $T/h-alloc-$dtemplate.json
+done
+$CLUSTER gnt-debug allocator --dir in --mode relocate \
+    -o no_such_os $IR > $T/h-reloc.json
+$CLUSTER gnt-debug allocator --dir in --mode multi-evacuate \
+    $FN > $T/h-evacuate.json
+for dtemplate in plain drbd; do
+  echo Testing hail/allocate-$dtemplate
+  ./hail $T/h-alloc-$dtemplate.json
+done
+echo Testing hail/relocate for instance $IR
 ./hail $T/h-reloc.json
+echo Testing hail/evacuate for node $FN
+./hail $T/h-evacuate.json
 
 HOUT="$T/hspace.out"
 
@@ -69,16 +96,16 @@ check_hspace_out() {
 
 TIER="--tiered 102400,8192,2"
 echo Testing hspace/luxi
-./hspace -L$LUXI $TIER > $HOUT
+./hspace -L$LUXI $TIER -v > $HOUT
 ( check_hspace_out ) || exit 1
 echo Testing hspace/rapi
-./hspace -m$RAPI $TIER > $HOUT
+./hspace -m$RAPI $TIER -v > $HOUT
 ( check_hspace_out ) || exit 1
 echo Testing hspace/text
-./hspace -t$T/$RAPI.data $TIER > $HOUT
+./hspace -t$T/$RAPI.data $TIER -v > $HOUT
 ( check_hspace_out ) || exit 1
 echo Testing hspace/simu
 # ~6T disk space, 32G ram, 4 VCPUs
-./hspace --simu=10,6835937,32768,4 $TIER > $HOUT
+./hspace --simu=10,6835937,32768,4 $TIER -v > $HOUT
 ( check_hspace_out ) || exit 1
 echo All OK
-- 
GitLab