]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/workunits: mon: auth_caps: account for mon blank caps
authorJoao Eduardo Luis <joao@redhat.com>
Tue, 30 Sep 2014 18:13:52 +0000 (19:13 +0100)
committerJoao Eduardo Luis <joao@redhat.com>
Fri, 3 Oct 2014 15:24:20 +0000 (16:24 +0100)
test creating and entity with blank caps with and without '--force'
being specified.  without '--force' they must fail with EINVAL as the
monitor will not be able to parse them.

Signed-off-by: Joao Eduardo Luis <joao@redhat.com>
qa/workunits/mon/auth_caps.sh

index 43d5747ce2df6d4d90cf49f3e692dcc627d627e0..74b22778c00876ceee9a70a997fc470a76075b8f 100755 (executable)
@@ -13,7 +13,8 @@ for i in ${combinations}; do
 done
 
 # add special caps
-keymap["blank"]=`ceph auth get-or-create-key client.blank mon 'allow'` || exit 1
+# force blank cap with '--force'
+keymap["blank"]=`ceph auth get-or-create-key client.blank mon 'allow' --force` || exit 1
 keymap["all"]=`ceph auth get-or-create-key client.all mon 'allow *'` || exit 1
 
 tmp=`mktemp`
@@ -79,6 +80,7 @@ write_ops() {
   local caps=$1
   local has_read=1 has_write=1 has_exec=1
   local ret
+  local err
   local args
 
   ( echo $caps | grep 'r' ) || has_read=0
@@ -101,9 +103,16 @@ write_ops() {
   expect $ret ceph auth add client.foo $args
   expect $ret "ceph auth caps client.foo mon 'allow *' $args"
   expect $ret ceph auth get-or-create client.admin $args
-  expect $ret "ceph auth get-or-create client.bar mon 'allow' $args"
+  echo "wtf -- before: err=$err ret=$ret"
+  err=$ret
+  [[ $ret -eq 0 ]] && err=22 # EINVAL
+  expect $err "ceph auth get-or-create client.bar mon 'allow' $args"
+  echo "wtf -- after: err=$err ret=$ret"
+  expect $ret "ceph auth get-or-create client.bar mon 'allow' --force $args"
   expect $ret ceph auth get-or-create-key client.admin $args
   expect $ret ceph auth get-or-create-key client.baz $args
+  expect $ret ceph auth del client.bar $args
+  expect $ret ceph auth del client.baz $args
   expect $ret ceph auth del client.foo $args
   expect $ret ceph auth import -i $tmp $args
 }