From: Sage Weil Date: Wed, 5 Mar 2014 20:52:08 +0000 (-0800) Subject: qa/workunits/mon/crush_ops: use expect_false X-Git-Tag: v0.78~78^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ca12e0d92ee22fc999d68853011b2bef926c89b2;p=ceph.git qa/workunits/mon/crush_ops: use expect_false Signed-off-by: Sage Weil --- diff --git a/qa/workunits/mon/crush_ops.sh b/qa/workunits/mon/crush_ops.sh index cb9ab51f5d77..d27e2f9dde45 100755 --- a/qa/workunits/mon/crush_ops.sh +++ b/qa/workunits/mon/crush_ops.sh @@ -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