]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume tests add tests for get_block_devs
authorAlfredo Deza <adeza@redhat.com>
Thu, 3 May 2018 16:45:05 +0000 (12:45 -0400)
committerAndrew Schoen <aschoen@redhat.com>
Wed, 13 Jun 2018 14:30:54 +0000 (09:30 -0500)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
(cherry picked from commit 672c4c4d1c31b4631b1238ed0efb98fef34f2a3d)

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

index 625116b44b404618e9a40aecc2e3e0df552dc72c..dc6f208f7a82432f079b58fc6c7ca1b40b32d2d2 100644 (file)
@@ -84,3 +84,16 @@ class TestMapDevPaths(object):
         assert result['dm-0'] == dm_path
         assert result[sda_path] == sda_path
         assert result[dm_path] == 'dm-0'
+
+
+class TestGetBlockDevs(object):
+
+    def test_loop_devices_are_missing(self, tmpfile):
+        path = os.path.dirname(tmpfile(name='loop0', contents=''))
+        result = disk.get_block_devs(sys_block_path=path)
+        assert result == []
+
+    def test_loop_devices_are_included(self, tmpfile):
+        path = os.path.dirname(tmpfile(name='loop0', contents=''))
+        result = disk.get_block_devs(sys_block_path=path, skip_loop=False)
+        assert result == ['loop0']