]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
ceph-volume: fix test_reject_readonly_device unit test
authorGuillaume Abrioux <gabrioux@ibm.com>
Wed, 18 Feb 2026 12:41:37 +0000 (13:41 +0100)
committerGuillaume Abrioux <gabrioux@ibm.com>
Wed, 18 Feb 2026 12:41:37 +0000 (13:41 +0100)
this mocks "partitions" in device info so Device._parse() does not
raise KeyError and both /dev/cdrom and /dev/sr0 so the test passes
when cdrom is a symlink to sr0.

Signed-off-by: Guillaume Abrioux <gabrioux@ibm.com>
src/ceph-volume/ceph_volume/tests/util/test_device.py

index e238cdfb6677d0299c5cda8b4d94864581d6fc91..1667979088f385146ec0a73b2289476bb5cf4b39 100644 (file)
@@ -306,9 +306,10 @@ class TestDevice(object):
 
     @patch("ceph_volume.util.disk.has_bluestore_label", lambda x: False)
     def test_reject_readonly_device(self, fake_call, device_info):
-        data = {"/dev/cdrom": {"ro": "1"}}
+        readonly_info = {"ro": "1", "partitions": {}}
+        data = {"/dev/cdrom": dict(readonly_info), "/dev/sr0": dict(readonly_info)}
         lsblk = {"TYPE": "disk", "NAME": "cdrom"}
-        device_info(devices=data,lsblk=lsblk)
+        device_info(devices=data, lsblk=lsblk)
         disk = device.Device("/dev/cdrom")
         assert not disk.available