From: Loic Dachary Date: Thu, 16 Oct 2014 00:21:44 +0000 (-0700) Subject: mon: unit tests for osd crush rename-bucket X-Git-Tag: v0.88~64^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4606af7901392f44c162bee88bde432d430ffd4a;p=ceph.git mon: unit tests for osd crush rename-bucket Signed-off-by: Loic Dachary --- diff --git a/src/test/mon/osd-crush.sh b/src/test/mon/osd-crush.sh index 56c85735df2f..e7a98e8166b8 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 7f492ed90835..b3c619893f0b 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-_.='])