]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume/tests: add a unit test
authorGuillaume Abrioux <gabrioux@redhat.com>
Tue, 16 Aug 2022 15:25:52 +0000 (17:25 +0200)
committerKonstantin Shalygin <k0ste@k0ste.ru>
Wed, 29 Nov 2023 11:46:07 +0000 (18:46 +0700)
In order to test that get_devices() returns the correct
number of actuators when such a device is being processed.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit ea900373b524c321478fcc8f550090709dba2ecb)

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

index fcd644a861b53be67147a9751e6b0d2942a1d726..f9e2b76b27d40eb7bb83b18d1b781fa5d2c2b6d5 100644 (file)
@@ -286,6 +286,16 @@ class TestGetDevices(object):
         result = disk.get_devices()
         assert rbd_path not in result
 
+    @patch('ceph_volume.util.disk.is_locked_raw_device', lambda x: False)
+    def test_actuator_device(self, patched_get_block_devs_sysfs, fake_filesystem):
+        sda_path = '/dev/sda'
+        fake_actuator_nb = 2
+        patched_get_block_devs_sysfs.return_value = [[sda_path, sda_path, 'disk']]
+        for actuator in range(0, fake_actuator_nb):
+            fake_filesystem.create_dir(f'/sys/block/sda/queue/independent_access_ranges/{actuator}')
+        result = disk.get_devices()
+        assert result[sda_path]['actuators'] == fake_actuator_nb
+
 
 class TestSizeCalculations(object):