mon: unit tests for osd crush rename-bucket

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
This commit is contained in:
Loic Dachary 2014-10-15 17:21:44 -07:00
parent aa675604c9
commit 4606af7901
2 changed files with 32 additions and 0 deletions

View File

@ -175,6 +175,17 @@ EOF
}
function TEST_crush_rename_bucket() {
local dir=$1
./ceph osd crush add-bucket host1 host
! ./ceph osd tree | grep host2 || return 1
./ceph osd crush rename-bucket host1 host2 || return 1
./ceph osd tree | grep host2 || return 1
./ceph osd crush rename-bucket host1 host2 || return 1 # idempotency
./ceph osd crush rename-bucket nonexistent something 2>&1 | grep "Error ENOENT" || return 1
}
main osd-crush
# Local Variables:

View File

@ -5,6 +5,7 @@
# Ceph - scalable distributed file system
#
# Copyright (C) 2013,2014 Cloudwatt <libre.licensing@cloudwatt.com>
# Copyright (C) 2014 Red Hat <contact@redhat.com>
#
# Author: Loic Dachary <loic@dachary.org>
#
@ -619,6 +620,26 @@ class TestOSD(TestArgparse):
'add-bucket', '^^^',
'type']))
def test_crush_rename_bucket(self):
self.assert_valid_command(['osd', 'crush', 'rename-bucket',
'srcname', 'dstname'])
assert_equal({}, validate_command(sigdict, ['osd', 'crush']))
assert_equal({}, validate_command(sigdict, ['osd', 'crush',
'rename-bucket']))
assert_equal({}, validate_command(sigdict, ['osd', 'crush',
'rename-bucket',
'srcname']))
assert_equal({}, validate_command(sigdict, ['osd', 'crush',
'rename-bucket', 'srcname',
'dstname',
'toomany']))
assert_equal({}, validate_command(sigdict, ['osd', 'crush',
'rename-bucket', '^^^',
'dstname']))
assert_equal({}, validate_command(sigdict, ['osd', 'crush',
'rename-bucket', 'srcname',
'^^^^']))
def check_crush_setter(self, setter):
self.assert_valid_command(['osd', 'crush', setter,
'*', '2.3', 'AZaz09-_.='])