From: Guillaume Abrioux Date: Tue, 16 Aug 2022 15:25:52 +0000 (+0200) Subject: ceph-volume/tests: add a unit test X-Git-Tag: v16.2.15~43^2~4 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=782eaef3bd9b84a26248c33e110b9866712abba5;p=ceph.git ceph-volume/tests: add a unit test 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 (cherry picked from commit ea900373b524c321478fcc8f550090709dba2ecb) --- diff --git a/src/ceph-volume/ceph_volume/tests/util/test_disk.py b/src/ceph-volume/ceph_volume/tests/util/test_disk.py index fcd644a861b53..f9e2b76b27d40 100644 --- a/src/ceph-volume/ceph_volume/tests/util/test_disk.py +++ b/src/ceph-volume/ceph_volume/tests/util/test_disk.py @@ -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):