From: Alfredo Deza Date: Wed, 23 Apr 2014 20:21:37 +0000 (-0400) Subject: tests for figuring out the mount point X-Git-Tag: v1.5.0~9^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9f66a9b59f6c41928598fa6faa507f7febd3c841;p=ceph-deploy.git tests for figuring out the mount point Signed-off-by: Alfredo Deza --- diff --git a/ceph_deploy/tests/unit/test_osd.py b/ceph_deploy/tests/unit/test_osd.py new file mode 100644 index 0000000..4b00408 --- /dev/null +++ b/ceph_deploy/tests/unit/test_osd.py @@ -0,0 +1,37 @@ +from ceph_deploy import osd + + +class TestMountPoint(object): + + def setup(self): + self.osd_name = 'osd.1' + + def test_osd_name_not_found(self): + output = [ + '/dev/sda :', + ' /dev/sda1 other, ext2, mounted on /boot', + ' /dev/sda2 other', + ' /dev/sda5 other, LVM2_member', + ] + assert osd.get_osd_mount_point(output, self.osd_name) is None + + def test_osd_name_is_found(self): + output = [ + '/dev/sda :', + ' /dev/sda1 other, ext2, mounted on /boot', + ' /dev/sda2 other', + ' /dev/sda5 other, LVM2_member', + '/dev/sdb :', + ' /dev/sdb1 ceph data, active, cluster ceph, osd.1, journal /dev/sdb2', + ] + result = osd.get_osd_mount_point(output, self.osd_name) + assert result == '/dev/sdb1' + + def test_osd_name_not_found_but_contained_in_output(self): + output = [ + '/dev/sda :', + ' /dev/sda1 otherosd.1, ext2, mounted on /boot', + ' /dev/sda2 other', + ' /dev/sda5 other, LVM2_member', + ] + assert osd.get_osd_mount_point(output, self.osd_name) is None