Skip to content

Commit 2ae027f

Browse files
committed
qa: test auth rotate
Signed-off-by: Patrick Donnelly <[email protected]>
1 parent d57326f commit 2ae027f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

qa/workunits/cephtool/test.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,26 @@ function test_auth()
609609
ceph auth del client.xx
610610
expect_false ceph auth get client.xx
611611

612+
# test rotation
613+
ceph auth get-or-create client.admin2 mon 'allow *'
614+
ceph auth get client.admin2 >> keyring1
615+
env CEPH_KEYRING=keyring1 ceph -n client.admin2 auth get client.admin2 >> keyring2
616+
# they are the same:
617+
expect_true diff -au keyring1 keyring2
618+
# rotate itself
619+
env CEPH_KEYRING=keyring1 ceph -n client.admin2 auth rotate client.admin2 >> keyring3
620+
# only the key has changed:
621+
diff -au keyring1 keyring3 | grep -E '^[-+][^-+]' | expect_false grep -v key
622+
# the key in keyring1 no longer works:
623+
expect_false env CEPH_KEYRING=keyring1 ceph -n client.admin2 auth get client.admin2
624+
# the key in keyring3 should work:
625+
expect_true env CEPH_KEYRING=keyring3 ceph -n client.admin2 auth get client.admin2
626+
# now verify the key from `auth get` matches what rotate produced:
627+
expect_true ceph auth get client.admin2 >> keyring4
628+
expect_true diff -au keyring3 keyring4
629+
expect_true ceph auth rm client.admin2
630+
rm keyring[1234]
631+
612632
# (almost) interactive mode
613633
echo -e 'auth add client.xx mon "allow *" osd "allow *"\n' | ceph
614634
ceph auth get client.xx

0 commit comments

Comments
 (0)