]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume tests verify mapper and /dev devices
authorAlfredo Deza <adeza@redhat.com>
Thu, 3 May 2018 16:47:53 +0000 (12:47 -0400)
committerAlfredo Deza <adeza@redhat.com>
Wed, 1 Aug 2018 15:38:29 +0000 (11:38 -0400)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
(cherry picked from commit 9cfd37344c69ebf1f3d8440f295d79ae05b545e9)

src/ceph-volume/ceph_volume/tests/util/test_disk.py

index dc6f208f7a82432f079b58fc6c7ca1b40b32d2d2..cbe111f04896f7d7b10771bff4bf0ee12f55eb3f 100644 (file)
@@ -97,3 +97,29 @@ class TestGetBlockDevs(object):
         path = os.path.dirname(tmpfile(name='loop0', contents=''))
         result = disk.get_block_devs(sys_block_path=path, skip_loop=False)
         assert result == ['loop0']
+
+
+class TestGetDevDevs(object):
+
+    def test_abspaths_are_included(self, tmpfile):
+        sda_path = tmpfile(name='sda', contents='')
+        directory = os.path.dirname(sda_path)
+        result = disk.get_dev_devs(directory)
+        assert sorted(result.keys()) == sorted(['sda', sda_path])
+        assert result['sda'] == sda_path
+        assert result[sda_path] == 'sda'
+
+
+class TestGetMapperDevs(object):
+
+    def test_abspaths_and_realpaths_are_included(self, tmpfile):
+        dm_path = tmpfile(name='dm-0', contents='')
+        directory = os.path.dirname(dm_path)
+        sda_path = os.path.join(directory, 'sda')
+        os.symlink(sda_path, os.path.join(directory, 'sda'))
+        result = disk.get_mapper_devs(directory)
+        assert sorted(result.keys()) == sorted([dm_path, sda_path, 'sda', 'dm-0'])
+        assert result['sda'] == sda_path
+        assert result['dm-0'] == dm_path
+        assert result[sda_path] == sda_path
+        assert result[dm_path] == 'dm-0'