]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
tests for figuring out the mount point
authorAlfredo Deza <alfredo.deza@inktank.com>
Wed, 23 Apr 2014 20:21:37 +0000 (16:21 -0400)
committerAlfredo Deza <alfredo.deza@inktank.com>
Wed, 23 Apr 2014 20:25:58 +0000 (16:25 -0400)
Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com>
ceph_deploy/tests/unit/test_osd.py [new file with mode: 0644]

diff --git a/ceph_deploy/tests/unit/test_osd.py b/ceph_deploy/tests/unit/test_osd.py
new file mode 100644 (file)
index 0000000..4b00408
--- /dev/null
@@ -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