]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/workunits/mon/crush_ops: use expect_false
authorSage Weil <sage@inktank.com>
Wed, 5 Mar 2014 20:52:08 +0000 (12:52 -0800)
committerSage Weil <sage@inktank.com>
Wed, 5 Mar 2014 20:52:08 +0000 (12:52 -0800)
Signed-off-by: Sage Weil <sage@inktank.com>
qa/workunits/mon/crush_ops.sh

index cb9ab51f5d77e4b2f5a568bcd8a12df323c5d61c..d27e2f9dde45ced39aa2e6a06d5177e6935a6169 100755 (executable)
@@ -1,7 +1,13 @@
-#!/bin/sh -x
+#!/bin/bash -x
 
 set -e
 
+function expect_false()
+{
+       set -x
+       if "$@"; then return 1; else return 0; fi
+}
+
 ceph osd crush dump
 
 # rules
@@ -20,7 +26,7 @@ ceph osd crush rule rm foo  # idempotent
 ceph osd crush rule rm bar
 
 # can't delete in-use rules, tho:
-ceph osd crush rule rm replicated_ruleset && exit 1 || true
+expect_false ceph osd crush rule rm replicated_ruleset
 
 # build a simple map
 ceph osd crush add-bucket foo root
@@ -41,20 +47,20 @@ ceph osd tree | grep -c osd.$o1 | grep -q 2
 ceph osd tree | grep -c host1 | grep -q 2
 ceph osd tree | grep -c osd.$o2 | grep -q 2
 ceph osd tree | grep -c host2 | grep -q 2
-ceph osd crush rm host1 foo && exit 1 || true   # not empty
+expect_false ceph osd crush rm host1 foo   # not empty
 ceph osd crush unlink host1 foo
 ceph osd crush unlink host1 foo
 ceph osd tree | grep -c host1 | grep -q 1
 
-ceph osd crush rm foo  && exit 1 || true  # not empty
-ceph osd crush rm bar  && exit 1 || true  # not empty
+expect_false ceph osd crush rm foo  # not empty
+expect_false ceph osd crush rm bar  # not empty
 ceph osd crush unlink host1 bar
 ceph osd tree | grep -c host1 | grep -q 1   # now an orphan
 ceph osd crush rm osd.$o1 host1
 ceph osd crush rm host1
 ceph osd tree | grep -c host1 | grep -q 0
 
-ceph osd crush rm bar && exit 1 || true   # not empty
+expect_false ceph osd crush rm bar   # not empty
 ceph osd crush unlink host2
 ceph osd crush rm bar
 ceph osd crush rm foo