summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Mick <dan.mick@inktank.com>2013-08-02 20:50:20 -0700
committerDan Mick <dan.mick@inktank.com>2013-08-05 11:20:41 -0700
commit55095d56ea9179ee3025719dc0c4e9a8d018df13 (patch)
tree810c375d500d0593cf939e48ccfa75eab2d9653e
parent71ff794eca7dd57a0b0473530f685069ac9987f0 (diff)
downloadceph-55095d56ea9179ee3025719dc0c4e9a8d018df13.tar.gz
cephtool/test.sh: add a few tests for invalid command args
Signed-off-by: Dan Mick <dan.mick@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com>
-rwxr-xr-xqa/workunits/cephtool/test.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/qa/workunits/cephtool/test.sh b/qa/workunits/cephtool/test.sh
index d759d675276..e84119920cf 100755
--- a/qa/workunits/cephtool/test.sh
+++ b/qa/workunits/cephtool/test.sh
@@ -25,6 +25,29 @@ expect_false()
if "$@"; then return 1; else return 0; fi
}
+TMPFILE=/tmp/test_invalid.$$
+trap "rm $TMPFILE" 0
+
+function check_response()
+{
+ retcode=$1
+ expected_retcode=$2
+ expected_stderr_string=$3
+ if [ $1 != $2 ] ; then
+ echo "return code invalid: got $1, expected $2" >&2
+ exit 1
+ fi
+
+ if ! grep "$3" $TMPFILE >/dev/null 2>&1 ; then
+ echo "Didn't find $3 in stderr output" >&2
+ echo "Stderr: " >&2
+ cat $TMPFILE >&2
+ exit 1
+ fi
+}
+
+
+
#
# Assumes there are at least 3 MDSes and two OSDs
#
@@ -255,4 +278,18 @@ ceph osd pool get rbd crush_ruleset | grep 'crush_ruleset: 2'
ceph osd thrash 10
+set +e
+
+# expect error about missing 'pool' argument
+ceph osd map 2>$TMPFILE; check_response $? 22 'pool'
+
+# expect error about unused argument foo
+ceph osd ls foo 2>$TMPFILE; check_response $? 22 'unused'
+
+# expect "not in range" for invalid full ratio
+ceph pg set_full_ratio 95 2>$TMPFILE; check_response $? 22 'not in range'
+
+# expect "not in range" for invalid overload percentage
+ceph osd reweight-by-utilization 80 2>$TMPFILE; check_response $? 22 'not in range'
+
echo OK