From 165b385b1f0e67c0e407a4bd31ada416da2c8817 Mon Sep 17 00:00:00 2001
From: Agata Murawska <agatamurawska@google.com>
Date: Thu, 21 Jun 2012 12:31:24 +0200
Subject: [PATCH] Shelltestrunner tests for hcheck
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Simple tests for hcheck using shelltestrunner. Among other, we check
that we can run hcheck on multi-group cluster.

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: RenΓ© Nussbaumer <rn@google.com>
---
 test/htools-balancing.test    | 5 +++++
 test/htools-basic.test        | 4 ++++
 test/htools-invalid.test      | 9 +++++++++
 test/htools-multi-group.test  | 5 +++++
 test/htools-single-group.test | 5 +++++
 5 files changed, 28 insertions(+)

diff --git a/test/htools-balancing.test b/test/htools-balancing.test
index 37e9e832d..5647cb550 100644
--- a/test/htools-balancing.test
+++ b/test/htools-balancing.test
@@ -32,6 +32,11 @@ diff -u $T/simu-rebal-merged.standard $T/simu-rebal.standard.original
 >>> /(Nothing to do, exiting|No solution found)/
 >>>= 0
 
+# hcheck sees no reason to rebalance after rebalancing was already done
+./test/hcheck -t$T/simu-rebal.standard.balanced --machine-readable
+>>>1 /HCHECK_INIT_CLUSTER_NEED_REBALANCE=0/
+>>>= 0
+
 ### now tiered tests
 
 # test basic parsing
diff --git a/test/htools-basic.test b/test/htools-basic.test
index 39a8807eb..d05d54406 100644
--- a/test/htools-basic.test
+++ b/test/htools-basic.test
@@ -19,3 +19,7 @@
 >>>= 0
 ./test/hinfo --help
 >>>= 0
+./test/hcheck --version
+>>>= 0
+./test/hcheck --help
+>>>= 0
\ No newline at end of file
diff --git a/test/htools-invalid.test b/test/htools-invalid.test
index 1d57cce6b..f8849cf1a 100644
--- a/test/htools-invalid.test
+++ b/test/htools-invalid.test
@@ -18,6 +18,10 @@
 ./test/hinfo --no-such-option
 >>>= 2
 
+# invalid option test
+./test/hcheck --no-such-option
+>>>= 2
+
 # extra arguments
 ./test/hspace unexpected-argument
 >>>2
@@ -33,3 +37,8 @@ Error: this program doesn't take any arguments.
 >>>2
 Error: this program doesn't take any arguments.
 >>>=1
+
+./test/hcheck unexpected-argument
+>>>2
+Error: this program doesn't take any arguments.
+>>>=1
\ No newline at end of file
diff --git a/test/htools-multi-group.test b/test/htools-multi-group.test
index b39dd8e89..2f6ec7213 100644
--- a/test/htools-multi-group.test
+++ b/test/htools-multi-group.test
@@ -33,3 +33,8 @@
 # and it should not find an invalid group
 ./test/hbal -t$T/simu-twogroups.tiered -G no-such-group
 >>>= !0
+
+# hcheck should be able to run with multiple groups
+./test/hcheck -t$T/simu-twogroups.tiered --machine-readable
+>>>1 /HCHECK_OK=1/
+>>>= 0
\ No newline at end of file
diff --git a/test/htools-single-group.test b/test/htools-single-group.test
index c77db81c0..202926255 100644
--- a/test/htools-single-group.test
+++ b/test/htools-single-group.test
@@ -22,3 +22,8 @@
 ./test/hbal -t$T/simu-onegroup.tiered
 >>> /(Nothing to do, exiting|No solution found)/
 >>>= 0
+
+# hcheck should not find reason to rebalance
+./test/hcheck -t$T/simu-onegroup.tiered --machine-readable
+>>>1 /HCHECK_INIT_CLUSTER_NEED_REBALANCE=0/
+>>>= 0
\ No newline at end of file
-- 
GitLab