Add utilisation and instance selection tests
authorIustin Pop <iustin@google.com>
Fri, 9 Mar 2012 14:20:39 +0000 (15:20 +0100)
committerIustin Pop <iustin@google.com>
Thu, 15 Mar 2012 16:22:31 +0000 (17:22 +0100)
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: RenĂ© Nussbaumer <rn@google.com>

htools/offline-test.sh

index f5708a1..f225b75 100755 (executable)
@@ -130,6 +130,28 @@ for suffix in standard tiered; do
 done
 echo OK
 
+echo Checking utilisation-based code
+BACKEND="-t $T/simu-onegroup.standard"
+echo a > $T/dynu
+(! hbal -U <(echo a) $BACKEND  2>&1 ) | grep -q "Cannot parse line"
+(! hbal -U <(echo a b c d e f g h) $BACKEND 2>&1 ) | \
+  grep -q "Cannot parse line"
+(! hbal -U <(echo inst cpu mem dsk net) $BACKEND 2>&1 ) | \
+  grep -Eq "cannot parse string '(cpu|mem|dsk|net)'"
+# unknown instances are currently just ignored
+hbal -U <(echo no-such-inst 2 2 2 2) $BACKEND >/dev/null 2>&1
+# new-0 is the name of the first instance allocated by hspace
+hbal -U <(echo new-0 2 2 2 2) $BACKEND >/dev/null 2>&1
+echo OK
+
+echo Checking selected/excluded instances
+(! hbal $BACKEND --exclude-instances no-such-instance 2>&1 ) | \
+  grep -q "Unknown instance"
+(! hbal $BACKEND --select-instances no-such-instances 2>&1 ) | \
+  grep -q "Unknown instance"
+hbal $BACKEND --exclude-instances new-0 --select-instances new-1 >/dev/null
+echo OK
+
 echo IAllocator checks
 # test that on invalid files it can't parse the request
 (! hail /dev/null 2>&1 ) | grep -q "Invalid JSON"