diff --git a/src/test/mon/osd-crush.sh b/src/test/mon/osd-crush.sh index 56c85735df2..e7a98e8166b 100755 --- a/src/test/mon/osd-crush.sh +++ b/src/test/mon/osd-crush.sh @@ -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: diff --git a/src/test/pybind/test_ceph_argparse.py b/src/test/pybind/test_ceph_argparse.py index 7f492ed9083..b3c619893f0 100755 --- a/src/test/pybind/test_ceph_argparse.py +++ b/src/test/pybind/test_ceph_argparse.py @@ -5,6 +5,7 @@ # Ceph - scalable distributed file system # # Copyright (C) 2013,2014 Cloudwatt +# Copyright (C) 2014 Red Hat # # Author: Loic Dachary # @@ -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-_.='])