diff options
author | Joao Eduardo Luis <joao.luis@inktank.com> | 2013-07-20 04:30:59 +0100 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-07-19 21:18:07 -0700 |
commit | fb2150425b5d41334763eb60f8ff648166aef7a1 (patch) | |
tree | c73cd2546316942faf5dd8cbc4b0c007b74db332 | |
parent | 73b4003f6545ae1ed9efd3abc3b25bd3ebd73c46 (diff) | |
download | ceph-fb2150425b5d41334763eb60f8ff648166aef7a1.tar.gz |
qa: workunits: mon: test mon caps permissions
set env var TEST_EXIT_ON_ERROR=0 to obtain all errors instead of exiting
with return 1 on first error found.
Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
-rwxr-xr-x | qa/workunits/mon/caps_madness.sh | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/qa/workunits/mon/caps_madness.sh b/qa/workunits/mon/caps_madness.sh new file mode 100755 index 00000000000..07a45756c1c --- /dev/null +++ b/qa/workunits/mon/caps_madness.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +tmp=/tmp/cephtest-mon-caps-madness + +exit_on_error=1 + +[[ ! -z $TEST_EXIT_ON_ERROR ]] && exit_on_error=$TEST_EXIT_ON_ERROR + +expect() +{ + cmd=$1 + expected_ret=$2 + + echo $cmd + eval $cmd >&/dev/null + ret=$? + + if [[ $ret -ne $expected_ret ]]; then + echo "Error: Expected return $expected_ret, got $ret" + [[ $exit_on_error -eq 1 ]] && exit 1 + return 1 + fi + + return 0 +} + +expect "ceph auth get-or-create client.bazar > $tmp.bazar.keyring" 0 +expect "ceph -k $tmp.bazar.keyring --user bazar mon_status" 13 + +c="'allow command \"auth list\", allow command mon_status'" +expect "ceph auth get-or-create client.foo mon $c > $tmp.foo.keyring" 0 +expect "ceph -k $tmp.foo.keyring --user foo mon_status" 0 +expect "ceph -k $tmp.foo.keyring --user foo auth list" 0 +expect "ceph -k $tmp.foo.keyring --user foo auth export" 13 +expect "ceph -k $tmp.foo.keyring --user foo auth del client.bazar" 13 +expect "ceph -k $tmp.foo.keyring --user foo osd dump" 13 +expect "ceph -k $tmp.foo.keyring --user foo pg dump" 13 +expect "ceph -k $tmp.foo.keyring --user foo quorum_status" 13 + +c="'allow command service with prefix=list, allow command mon_status'" +expect "ceph auth get-or-create client.bar mon $c > $tmp.bar.keyring" 0 +expect "ceph -k $tmp.bar.keyring --user bar mon_status" 0 +expect "ceph -k $tmp.bar.keyring --user bar auth list" 13 +expect "ceph -k $tmp.bar.keyring --user bar auth export" 13 +expect "ceph -k $tmp.bar.keyring --user bar auth del client.foo" 13 +expect "ceph -k $tmp.bar.keyring --user bar osd dump" 13 +expect "ceph -k $tmp.bar.keyring --user bar pg dump" 13 +expect "ceph -k $tmp.bar.keyring --user bar quorum_status" 13 + +rm $tmp.bazar.keyring $tmp.foo.keyring $tmp.bar.keyring |